Skip to content
Snippets Groups Projects
Commit fecc26c1 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

changed the way ae are initialized

parent 082cc389
No related branches found
No related tags found
1 merge request!4Dimensionality reduction algorithms
......@@ -43,8 +43,7 @@ void AutoencoderModel<TInputValue,AutoencoderType>::Train()
Shark::ListSampleToSharkVector(this->GetInputListSample(), features);
std::cout << "creating the data vector" << std::endl;
shark::Data<shark::RealVector> inputSamples = shark::createDataFromRange( features );
std::ofstream ofs;
if (this->m_WriteLearningCurve =true)
{
......@@ -100,8 +99,8 @@ void AutoencoderModel<TInputValue,AutoencoderType>::TrainOneLayer(shark::Abstrac
std::size_t inputs = dataDimension(samples);
net.setStructure(inputs, nbneuron);
//initRandomUniform(net,-0.1*std::sqrt(1.0/inputs),0.1*std::sqrt(1.0/inputs));
initRandomUniform(net,-1,1);
initRandomUniform(net,-0.1*std::sqrt(1.0/inputs),0.1*std::sqrt(1.0/inputs));
//initRandomUniform(net,-1,1);
shark::ImpulseNoiseModel noise(noise_strength,0.0); //set an input pixel with probability m_Noise to 0
shark::ConcatenatedModel<shark::RealVector,shark::RealVector> model = noise>> net;
shark::LabeledData<shark::RealVector,shark::RealVector> trainSet(samples,samples);//labels identical to inputs
......@@ -146,8 +145,9 @@ void AutoencoderModel<TInputValue,AutoencoderType>::TrainOneSparseLayer(shark::A
std::size_t inputs = dataDimension(samples);
net.setStructure(inputs, nbneuron);
//initRandomUniform(net,-0.1*std::sqrt(1.0/inputs),0.1*std::sqrt(1.0/inputs));
initRandomUniform(net,-1,1);
initRandomUniform(net,-0.1*std::sqrt(1.0/inputs),0.1*std::sqrt(1.0/inputs));
//initRandomUniform(net,-1,1);
shark::LabeledData<shark::RealVector,shark::RealVector> trainSet(samples,samples);//labels identical to inputs
shark::SquaredLoss<shark::RealVector> loss;
shark::SparseAutoencoderError error(trainSet,&net, &loss, rho, beta);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment