diff --git a/include/AutoencoderModel.h b/include/AutoencoderModel.h
index 739f13f6cb7b910a84fb4585344e28159368a945..b957d5d3115090392651afcb8d29db4c3638f639 100644
--- a/include/AutoencoderModel.h
+++ b/include/AutoencoderModel.h
@@ -61,6 +61,9 @@ public:
 
 	itkGetMacro(WriteLearningCurve,bool);
 	itkSetMacro(WriteLearningCurve,bool);
+		
+	itkSetMacro(WriteWeights, bool);
+	itkGetMacro(WriteWeights, bool);
 	
 	itkGetMacro(LearningCurveFileName,std::string);
 	itkSetMacro(LearningCurveFileName,std::string);
@@ -105,7 +108,7 @@ private:
 	
 	bool m_WriteLearningCurve; // Flag for writting the learning curve into a txt file
 	std::string m_LearningCurveFileName; // Name of the output learning curve printed after training
-	
+	bool m_WriteWeights;
 };
 } // end namespace otb
 
diff --git a/include/AutoencoderModel.txx b/include/AutoencoderModel.txx
index 8788315b72eebf862612f04c5484f4aeb97d9f3f..847c096b59f6d512b6637a5bbf5942cf56446e9a 100644
--- a/include/AutoencoderModel.txx
+++ b/include/AutoencoderModel.txx
@@ -208,6 +208,22 @@ void AutoencoderModel<TInputValue,AutoencoderType>::Save(const std::string & fil
 	//m_net.write(oa);
 	oa << m_net;
 	ofs.close();
+	
+	
+	if (this->m_WriteWeights == true)     // output the map vectors in a txt file
+	{
+		std::ofstream otxt(filename+".txt");
+		
+		for (unsigned int i = 0 ; i < m_NumberOfHiddenNeurons.Size(); ++i)
+		{
+			otxt << m_net[i].encoderMatrix() << std::endl;
+			otxt << m_net[i].hiddenBias() << std::endl;
+		}
+		otxt.close();
+	}
+	
+	
+	
 }
 
 template <class TInputValue, class AutoencoderType>
diff --git a/include/PCAModel.h b/include/PCAModel.h
index bd51913803b1f431305cdee05893dbc8b2246081..82ea0f8443a4caadc49bb6e66e91928a8cbf6a7b 100644
--- a/include/PCAModel.h
+++ b/include/PCAModel.h
@@ -42,6 +42,9 @@ public:
 	*/
 	itkSetMacro(Do_resize_flag,bool);
 	
+	itkSetMacro(WriteEigenvectors, bool);
+	itkGetMacro(WriteEigenvectors, bool);
+	
 	bool CanReadFile(const std::string & filename);
 	bool CanWriteFile(const std::string & filename);
 
@@ -66,6 +69,7 @@ private:
 	shark::PCA m_pca;
 	//unsigned int m_Dimension;
 	bool m_Do_resize_flag;
+	bool m_WriteEigenvectors;
 };
 } // end namespace otb
 
diff --git a/include/cbTrainAutoencoder.txx b/include/cbTrainAutoencoder.txx
index 244441d91868746af25458734b1ee313eb604da1..05c5ee0207a1411f927bbde925cec7b2d217130d 100644
--- a/include/cbTrainAutoencoder.txx
+++ b/include/cbTrainAutoencoder.txx
@@ -152,6 +152,7 @@ void cbLearningApplicationBaseDR<TInputValue,TOutputValue>
 		dimredTrainer->SetRho(rho);
 		dimredTrainer->SetBeta(beta);
 		
+		dimredTrainer->SetWriteWeights(true);
 		if (HasValue("model.autoencoder.learningcurve") && IsParameterEnabled("model.autoencoder.learningcurve"))
 		{
 			std::cout << "yo" << std::endl;