Пример #1
0
void MainWindow::on_pushButton_assignTime_clicked()
{
	int tsID = ui->tableWidget_timeStamps->getSelectedID();
	int runID = ui->tableWidget_main->currentRow()+1;

	RunData* run = competition()->getRun(runID);
	TimeStamp* ts = competition()->getTimeStamp(tsID);

	if(ts && run){
		assignmentManager.tryToAssignTimeStampToRun(tsID, runID);
	}
}
Пример #2
0
void MainWindow::on_pushButton_manualTrigger_clicked()
{
	TimeStamp* ts = new TimeStamp(0, getTimeBaseTime(), TimeStamp::M);
    competition()->addTimeStamp(ts);

	assignmentManager.tryToAssignTimeStampToRun(ts->getID());
}
bool SOMClusteringSpace::start_algorithm() {
  if ( initialize_algorithm() ) {
    int counter = 0;
    float global_error = MAX_FLOAT;
    int number_of_patterns = pGraph->numberOfNodes();
    Iterator<node>* node_iter = 0;
    patterns = pGraph->getProperty<DoubleVectorProperty>( patterns_prop_name );
    if (number_of_patterns > 0 && patterns != 0) {
      while (counter < lambda && global_error > epsilon) {
        node_iter = pGraph->getNodes();
        while( node_iter->hasNext() )
        {
          node n = node_iter->next();
          int winner_index = competition( n );
          assignation[n.id] = winner_index;
        }
        delete node_iter;
        counter++;
        learning_rate /= 1.1;
      }
    }
    return true;
  }
  return false;
}
Пример #4
0
unsigned int som::train(bool autostop) {
	previous_weights = NULL;

	for (unsigned int epouch = 1; epouch < (epouchs + 1); epouch++) {
		/* Depression term of coupling */
		local_radius = std::pow( ( params.init_radius * std::exp(-( (double) epouch / (double) epouchs)) ), 2);
		learn_rate = params.init_learn_rate * std::exp(-( (double) epouch / (double) epouchs));

		/* Feature SOM 0003: Clear statistics */
		if (autostop == true) {
			for (unsigned int i = 0; i < size; i++) {
				(*awards)[i] = 0;
				(*capture_objects)[i]->clear();
			}
		}

		for (unsigned int i = 0; i < data->size(); i++) {
			/* Step 1: Competition */
			unsigned int index_winner = competition(&(*data)[i]);

			/* Step 2: Adaptation */
			adaptation(index_winner, &(*data)[i]);

			/* Update statistics */
			if ( (autostop == true) || (epouch == (epouchs - 1)) ) {
				(*awards)[index_winner]++;
				(*capture_objects)[index_winner]->push_back(i);
			}
		}

		/* Feature SOM 0003: Check requirement of stopping */
		if (autostop == true) {
			if (previous_weights == NULL) {
				previous_weights = new std::vector<std::vector<double> * >(size, NULL);

				unsigned int dimensions = (*weights)[0]->size();
				for (unsigned int i = 0; i < weights->size(); i++) {
					(*previous_weights)[i] = new std::vector<double>(dimensions, 0.0);

					std::copy((*weights)[i]->begin(), (*weights)[i]->end(), (*previous_weights)[i]->begin());
				}
			}
			else {
				double maximal_adaptation = calculate_maximal_adaptation();
				if (maximal_adaptation < params.adaptation_threshold) {
					return epouch;
				}

				for (unsigned int i = 0; i < weights->size(); i++) {
					std::copy((*weights)[i]->begin(), (*weights)[i]->end(), (*previous_weights)[i]->begin());
				}
			}
		}
	}

	return epouchs;
}
Пример #5
0
unsigned int som::simulate(const std::vector<double> * pattern) const {
	return competition(pattern);
}