Skip to content

Commit

Permalink
use general features
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham808 committed Dec 9, 2018
1 parent 3822471 commit ed74e6d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/shogun/classifier/Perceptron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void CPerceptron::init_model(CFeatures* data)
if (!data->has_property(FP_DOT))
SG_ERROR("Specified features are not of type CDotFeatures\n")
set_features((CDotFeatures*) data);

SG_REF(data);
SG_UNREF(m_continue_features);
m_continue_features = data->as<CDotFeatures>();
Expand Down
2 changes: 1 addition & 1 deletion src/shogun/classifier/svm/NewtonSVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void CNewtonSVM::init_model(CFeatures* data)
if (!data->has_property(FP_DOT))
SG_ERROR("Specified features are not of type CDotFeatures\n")
set_features((CDotFeatures*) data);

SG_REF(data);
SG_UNREF(m_continue_features);
m_continue_features = data->as<CDotFeatures>();
Expand Down
26 changes: 15 additions & 11 deletions src/shogun/machine/IterativeMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,25 @@ namespace shogun
{
m_current_iteration = 0;
m_complete = false;
m_continue_features = NULL;
m_continue_features = nullptr;

SG_ADD(
&m_current_iteration, "current_iteration",
"Current Iteration of training");
SG_ADD(
&m_max_iterations, "max_iterations",
"Maximum number of Iterations", ParameterProperties::HYPER);
SG_ADD(
&m_complete, "complete", "Convergence status");
}
&m_complete, "complete", "Convergence status",
MS_NOT_AVAILABLE);
SG_ADD(
&m_continue_features, "continue_features", "Continue Features",
MS_NOT_AVAILABLE);

virtual ~CIterativeMachine()
{
SG_UNREF(m_continue_features);
virtual ~CIterativeMachine()
{
}
SG_UNREF(m_continue_features);
}

/** Returns convergence status */
Expand All @@ -58,8 +62,8 @@ namespace shogun
virtual bool continue_train()
{
this->reset_computation_variables();
this->set_features(m_continue_features);
this->put("features", m_continue_features);

auto pb = SG_PROGRESS(range(m_max_iterations));
while (m_current_iteration < m_max_iterations && !m_complete)
{
Expand Down Expand Up @@ -114,9 +118,9 @@ namespace shogun
virtual void end_training()
{
}

/** Stores features to continue training */
CDotFeatures* m_continue_features;
CFeatures* m_continue_features;
/** Maximum Iterations */
int32_t m_max_iterations;
/** Current iteration of training loop */
Expand Down

0 comments on commit ed74e6d

Please sign in to comment.