- fixed load and save
git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@628 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -530,6 +530,7 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
|
||||
//[UserButtonCode_loadButton] -- add your button handler code here..
|
||||
m_stack = new Stack(std::string(projectNameLabel->getText().getCharPointer()));
|
||||
m_stack->load(this);
|
||||
m_stack->loadWeights();
|
||||
m_rbmSelect->clear(dontSendNotification);
|
||||
|
||||
for (int id=0; id < m_stack->numLayers(); id++)
|
||||
@@ -810,69 +811,14 @@ void MainComponent::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails
|
||||
//[/UserCode_mouseWheelMove]
|
||||
}
|
||||
|
||||
|
||||
|
||||
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
|
||||
void MainComponent::save ()
|
||||
{
|
||||
m_stack->saveTraining(m_trainingData);
|
||||
m_stack->saveWeights();
|
||||
m_stack->save();
|
||||
}
|
||||
|
||||
void MainComponent::create(juce::String const &projectName)
|
||||
{
|
||||
m_stack = new Stack(std::string(projectName.getCharPointer()));
|
||||
|
||||
#if 0
|
||||
int id = m_rbmSelect->getSelectedId()-1;
|
||||
bool shouldAddItem = true;
|
||||
if (id == 0)
|
||||
{
|
||||
m_rbmSelect->clear(dontSendNotification);
|
||||
m_rbmSelect->addItem(String(id), id+1);
|
||||
m_rbmSelect->setSelectedId(id+1, dontSendNotification);
|
||||
|
||||
for (size_t i=0; i < DBN_SIZE; i++)
|
||||
{
|
||||
m_weights[i] = nullptr;
|
||||
m_pRbmComponent[i] = nullptr;
|
||||
}
|
||||
if (!projectName.isEmpty())
|
||||
{
|
||||
m_weights[id] = new Weights((String(projectName + String(".weights.dat"))).toUTF8());
|
||||
loadTraining((String(projectName + String(".trainingStates.dat"))).toUTF8());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_weights[id] = new Weights(numVisibleLabel->getText().getIntValue(), numVisibleYLabel->getText().getIntValue(), numHiddenLabel->getText().getIntValue());
|
||||
}
|
||||
addAndMakeVisible(m_pRbmComponent[id] = new RbmComponent(*m_weights[id], m_trainingData, *this));
|
||||
}
|
||||
else
|
||||
{
|
||||
shouldAddItem = m_pRbmComponent[id] == nullptr;
|
||||
m_weights[id] = nullptr;
|
||||
m_pRbmComponent[id] = nullptr;
|
||||
m_weights[id] = new Weights(m_weights[id-1]->getNumHidden(), 1, numHiddenLabel->getText().getIntValue());
|
||||
addAndMakeVisible(m_pRbmComponent[id] = new RbmComponent(*m_weights[id], m_pRbmComponent[id-1], *this));
|
||||
}
|
||||
m_pLayer = m_pRbmComponent[id];
|
||||
m_weightsCurr = m_weights[id];
|
||||
m_pLayer->setBounds (16, 140*id+16, 430, 130);
|
||||
m_pLayer->batchchanged();
|
||||
m_pLayer->redrawReconstruction();
|
||||
m_pLayer->redrawWeights();
|
||||
|
||||
if (((id+1) < DBN_SIZE) and shouldAddItem)
|
||||
m_rbmSelect->addItem(String(id+1), id+2);
|
||||
#endif
|
||||
updateControls();
|
||||
}
|
||||
|
||||
void MainComponent::destroy()
|
||||
{
|
||||
}
|
||||
|
||||
const juce::String& MainComponent::getBaseDir()
|
||||
{
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
|
||||
Reference in New Issue
Block a user