Viecombank::Viecombank(){ DSTaiKhoan.clear(); DSThe.clear(); DSPos.clear(); Link_The_TaiKhoan.clear(); ifstream fi("DuLieu/Viecombank/TheThanhToan.csv"); string input; while (getline(fi, input)){ The *TheMoi = new TheThanhToan_Viecombank(input); DSThe.insert(TheMoi); Link_The_TaiKhoan.insert(pair <string, string>(TheMoi->XemMaThe(), TheMoi->XemMaTKMacDinh())); } fi.close(); fi.open("DuLieu/Viecombank/ThePhu.csv"); while (getline(fi, input)){ ThePhu_Viecombank *TheMoi = new ThePhu_Viecombank(input); DSThe.insert(TheMoi); Link_The_TaiKhoan.insert(pair <string, string>(TheMoi->XemMaThe(), TheMoi->XemMaTKMacDinh())); } fi.close(); fi.open("DuLieu/Viecombank/TKTGTT.csv"); while (getline(fi, input)){ TaiKhoan *TKMoi = new TKTGTT_Viecombank(input); DSTaiKhoan.insert(TKMoi); } fi.close(); fi.open("DuLieu/Viecombank/The_PIN.csv"); while (getline(fi, input)){ int pos = input.find(','); string MaThe = input.substr(0, pos); input.erase(0, pos + 1); string PIN = input; PassWord[MaThe] = PIN; } fi.close(); fi.open("DuLieu/Viecombank/TKT.csv"); while (getline(fi, input)){ TaiKhoan *TKMoi = new TKT_Viecombank(input); DSTaiKhoan.insert(TKMoi); } fi.close(); fi.open("DuLieu/Viecombank/Pos.csv"); while (getline(fi, input)){ Pos *PosMoi = new Pos_Viecombank(input); DSPos.insert(PosMoi); } fi.close(); addSample(this); }
void ofApp::trainGMMFromData() { // setup a GMM with 2 dimensions (x,y) and 3 gaussians numGaussians = 3; gmm.setup(2, numGaussians); // SAMPLE DATA // add 100 samples centered around (220, 150) // add 150 samples centered around (430, 570) // add 100 samples centered around (820, 320) for (int i=0; i<100; i++) { addSample(220 + ofRandom(-100, 100), 150 + ofRandom(-95, 95)); } for (int i=0; i<150; i++) { addSample(430 + ofRandom(-180, 180), 570 + ofRandom(-120, 120)); } for (int i=0; i<100; i++) { addSample(820 + ofRandom(-90, 90), 320 + ofRandom(-150, 150)); } // train the GMM from data gmm.train(); // get a random sample from the GMM randSample = gmm.getRandomSample(); }
void TraceDataByRank::getData(Time timeStart, Time timeRange, double pixelLength) { // get the start location FileOffset startLoc = findTimeInInterval(timeStart, minloc, maxloc); // get the end location Time endTime = timeStart + timeRange; FileOffset endLoc = min( findTimeInInterval(endTime, minloc, maxloc) + SIZE_OF_TRACE_RECORD, maxloc); // get the number of records data to display Long numRec = 1 + getNumberOfRecords(startLoc, endLoc); // -------------------------------------------------------------------------------------------------- // if the data-to-display is fit in the display zone, we don't need to use recursive binary search // we just simply display everything from the file // -------------------------------------------------------------------------------------------------- if (numRec <= numPixelsH) { // display all the records for (FileOffset i = startLoc; i <= endLoc;) { listCPID->push_back(getData(i)); // one record of data contains of an integer (cpid) and a long (time) i = i + SIZE_OF_TRACE_RECORD; } } else { // the data is too big: try to fit the "big" data into the display //fills in the rest of the data for this process timeline sampleTimeLine(startLoc, endLoc, 0, numPixelsH, 0, pixelLength, timeStart); } // -------------------------------------------------------------------------------------------------- // get the last data if necessary: the rightmost time is still less then the upper limit // I think we can add the rightmost data into the list of samples // -------------------------------------------------------------------------------------------------- if (endLoc < maxloc) { TimeCPID dataLast = getData(endLoc); addSample(listCPID->size(), dataLast); } // -------------------------------------------------------------------------------------------------- // get the first data if necessary: the leftmost time is still bigger than the lower limit // similarly, we add to the list // -------------------------------------------------------------------------------------------------- if (startLoc > minloc) { TimeCPID dataFirst = getData(startLoc - SIZE_OF_TRACE_RECORD); addSample(0, dataFirst); } postProcess(); }
VTestPlugin::VTestPlugin() :SamplePlugin("VTestPlugin") { // add the playpen tests // addSample(new TextureBlitTest()); SEGFAULT reading depth texture addSample(new CubeMappingTest()); addSample(new ParticleTest()); addSample(new StencilShadowTest()); addSample(new TextureEffectsTest()); addSample(new TransparencyTest()); }
bool ClassificationData::merge(const ClassificationData &otherData){ if( otherData.getNumDimensions() != numDimensions ){ errorLog << "merge(const ClassificationData &labelledData) - The number of dimensions in the labelledData (" << otherData.getNumDimensions() << ") does not match the number of dimensions of this dataset (" << numDimensions << ")" << std::endl; return false; } //The dataset has changed so flag that any previous cross validation setup will now not work crossValidationSetup = false; crossValidationIndexs.clear(); const UINT M = otherData.getNumSamples(); //Reserve the memory reserve( getNumSamples() + M ); //Add the data from the labelledData to this instance for(UINT i=0; i<M; i++){ addSample(otherData[i].getClassLabel(), otherData[i].getSample()); } //Set the class names from the dataset Vector< ClassTracker > classTracker = otherData.getClassTracker(); for(UINT i=0; i<classTracker.getSize(); i++){ setClassNameForCorrespondingClassLabel(classTracker[i].className, classTracker[i].classLabel); } //Sort the class labels sortClassLabels(); return true; }
void MotionEvent::initialize( int32_t deviceId, int32_t source, int32_t action, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, float xOffset, float yOffset, float xPrecision, float yPrecision, nsecs_t downTime, nsecs_t eventTime, size_t pointerCount, const PointerProperties* pointerProperties, const PointerCoords* pointerCoords) { InputEvent::initialize(deviceId, source); mAction = action; mFlags = flags; mEdgeFlags = edgeFlags; mMetaState = metaState; mButtonState = buttonState; mXOffset = xOffset; mYOffset = yOffset; mXPrecision = xPrecision; mYPrecision = yPrecision; mDownTime = downTime; mPointerProperties.clear(); mPointerProperties.appendArray(pointerProperties, pointerCount); mSampleEventTimes.clear(); mSamplePointerCoords.clear(); addSample(eventTime, pointerCoords); }
void kSampleScrollView::addSamples(vector< shared_ptr<Sample> > _samples){ for (int i=0; i<_samples.size(); i++) { addSample(_samples[i]); } }
status_t InputConsumer::consumeSamples(InputEventFactoryInterface* factory, Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent) { MotionEvent* motionEvent = factory->createMotionEvent(); if (! motionEvent) return NO_MEMORY; uint32_t chain = 0; for (size_t i = 0; i < count; i++) { InputMessage& msg = batch.samples.editItemAt(i); updateTouchState(&msg); if (i) { SeqChain seqChain; seqChain.seq = msg.body.motion.seq; seqChain.chain = chain; mSeqChains.push(seqChain); addSample(motionEvent, &msg); } else { initializeMotionEvent(motionEvent, &msg); } chain = msg.body.motion.seq; } batch.samples.removeItemsAt(0, count); *outSeq = chain; *outEvent = motionEvent; return OK; }
void DataTable::addSample(std::initializer_list<DataPoint> samples) { for (auto& sample : samples) { addSample(sample); } }
/* * Created on: Oct 17, 2013 * Author: C15Brandon.Belcher * Description: Main.c to test out my movingAverages calculator. * Documentation: C2C Bentley explained how to use the functions in main so * that they can be tested. I then coded everything on my own. */ int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer int i; int j; volatile int maxNumberInArray; volatile int minNumberInArray; volatile unsigned int rangeOfNumbersInArray; int output[10]; int input[10] = {174, 162, 149, 85, 130, 149, 153, 164, 169, 173}; int samples[SAMPLE_SIZE]; for (i = 0; i < SAMPLE_SIZE; i++) { samples[i] = 0; } for (j = 0; j < 10; j++) { addSample(input[j], samples, SAMPLE_SIZE); output[j] = getAverage(samples, SAMPLE_SIZE); } maxNumberInArray = max(input, 10); minNumberInArray = min(input, 10); rangeOfNumbersInArray = range(input, 10); while(1){ } }
bool LabelledRegressionData::loadDatasetFromCSVFile(const string &filename,const UINT numInputDimensions,const UINT numTargetDimensions){ fstream file; string value; clear(); datasetName = "NOT_SET"; infoText = ""; //Clear any previous data clear(); //Parse the CSV file FileParser parser; if( !parser.parseCSVFile(filename,true) ){ errorLog << "loadDatasetFromCSVFile(...) - Failed to parse CSV file!" << endl; return false; } if( !parser.getConsistentColumnSize() ){ errorLog << "loadDatasetFromCSVFile(...) - The CSV file does not have a consistent number of columns!" << endl; return false; } if( parser.getColumnSize() != numInputDimensions+numTargetDimensions ){ errorLog << "loadDatasetFromCSVFile(...) - The number of columns in the CSV file (" << parser.getColumnSize() << ")"; errorLog << " does not match the number of input dimensions plus the number of target dimensions (" << numInputDimensions+numTargetDimensions << ")" << endl; return false; } //Setup the labelled classification data setInputAndTargetDimensions(numInputDimensions, numTargetDimensions); UINT n = 0; VectorDouble inputVector(numInputDimensions); VectorDouble targetVector(numTargetDimensions); for(UINT i=0; i<parser.getRowSize(); i++){ //Reset n n = 0; //Get the input vector for(UINT j=0; j<numInputDimensions; j++){ inputVector[j] = Util::stringToDouble( parser[i][n++] ); } //Get the target vector for(UINT j=0; j<numTargetDimensions; j++){ targetVector[j] = Util::stringToDouble( parser[i][n++] ); } //Add the labelled sample to the dataset if( !addSample(inputVector, targetVector) ){ warningLog << "loadDatasetFromCSVFile(string filename) - Could not add sample " << i << " to the dataset!" << endl; } } return true; }
bool BrainSoundFMODEX::loadMusic(const char* file) { if(addSample(file, m_music_id)) { return checkResult(m_sounds[m_music_id]->setMode(FMOD_LOOP_NORMAL)); } return false; }
void IdacDriverES::grabDataFromDll() { CDD32_STATUS cdErr = IdacGetStatusFlags(true); // FIXME: need to address the timeout error -- we keep timing out! //if (cdErr.bSyncFail || cdErr.bHwOverflow || cdErr.bSwOverflow || cdErr.bCommErr || cdErr.bTimeout) if (cdErr.bSyncFail || cdErr.bHwOverflow || cdErr.bSwOverflow || cdErr.bCommErr) { if (cdErr.bSyncFail) addError(tr("SYNC failed")); if (cdErr.bHwOverflow) addError(tr("Hardware Overflow")); if (cdErr.bSwOverflow) addError(tr("Software Overflow")); if (cdErr.bCommErr) addError(tr("Communication error")); if (cdErr.bTimeout) addError(tr("Timeout")); } // 2. Read data and send to display DWORD n = 0; LPCDD32_SAMPLE lpcs = NULL; // FIXME: for debug only //int nChannel0 = 0; // ENDFIX //qDebug() << "\tg1"; //QMutexLocker dataLocker(&m_dataMutex); //qDebug() << "\tg2"; short data[3]; while ((lpcs = IdacLockReadBuffer(&n))) { while (n > 0) { int iChannel = (int) lpcs->uChannel; if (iChannel >= 0 && iChannel < 3) { data[iChannel] = lpcs->nSample; if (iChannel == 2) { // The IDAC2 driver returns inverted signals compared to the IDAC4 if (m_bIdac2) data[0] = ~data[0]; addSample(data[0], data[1], data[2]); } } // FIXME: for debug only //if (iChannel == 0) // nChannel0++; // ENDFIX lpcs++; n--; } IdacUnlockReadBuffer(); } // FIXME: for debug only //qDebug() << "grab T:" << QTime::currentTime().msec() << nChannel0 << m_channelData[0].size(); // ENDFIX }
bool LabelledClassificationData::loadDatasetFromCSVFile(string filename,UINT classLabelColumnIndex){ numDimensions = 0; datasetName = "NOT_SET"; infoText = ""; //Clear any previous data clear(); //Parse the CSV file FileParser parser; if( !parser.parseCSVFile(filename,true) ){ errorLog << "loadDatasetFromCSVFile(string filename) - Failed to parse CSV file!" << endl; return false; } if( !parser.getConsistentColumnSize() ){ errorLog << "loadDatasetFromCSVFile(string filename) - The CSV file does not have a consistent number of columns!" << endl; return false; } if( parser.getColumnSize() <= 1 ){ errorLog << "loadDatasetFromCSVFile(string filename) - The CSV file does not have enough columns! It should contain at least two columns!" << endl; return false; } //Set the number of dimensions numDimensions = parser.getColumnSize()-1; UINT classLabel = 0; UINT j = 0; UINT n = 0; VectorDouble sample(numDimensions); for(UINT i=0; i<parser.getRowSize(); i++){ //Get the class label classLabel = Util::stringToInt( parser[i][classLabelColumnIndex] ); //Get the sample data j=0; n=0; while( j != numDimensions ){ if( n != classLabelColumnIndex ){ sample[j++] = Util::stringToDouble( parser[i][n] ); } n++; } //Add the labelled sample to the dataset if( !addSample(classLabel, sample) ){ warningLog << "loadDatasetFromCSVFile(string filename) - Could not add sample " << i << " to the dataset!" << endl; } } sortClassLabels(); return true; }
bool pdsp::Sampler::setSample(SampleBuffer* newSample, int index){ if(index<samples.size() && index>=0){ samples[index] = newSample; return true; }if(index == samples.size() ){ addSample(newSample); return true; }else{ return false; } }
int32_t Counter::filter(int32_t val) { double scaled_val = (double)val / (double)*internals->input_scale; addSample(internals->positions, (long)read_time, scaled_val); #if 0 if (internals->filter_type && *internals->filter_type == 0) { internals->last_sent = val; } else if (internals->filter_type && *internals->filter_type == 1) { int32_t mean = (internals->positions.average(internals->buffer_len) + 0.5f); if (internals->tolerance) internals->noise_tolerance = *internals->tolerance; if ( (uint32_t)abs(mean - internals->last_sent) >= internals->noise_tolerance) { internals->last_sent = mean; } } else if (internals->filter_type && *internals->filter_type == 2) { long res = (long)internals->filter(); internals->last_sent = (int32_t)(res / internals->filter_len *2); } #endif if (*internals->tolerance>1) { int32_t mean = (bufferAverage(internals->positions, *internals->filter_len) + 0.5f); long delta = (uint32_t)abs(mean - internals->last_sent); if ( delta >= *internals->tolerance) { internals->last_sent = mean; } } else internals->last_sent = (*internals->input_scale == 1) ? val : (uint32_t)( scaled_val + 0.5 ); internals->update(read_time); #if 1 /* most machines reading sensor values will be prompted when teh sensor value changes, depending on whether this filter yields a changed value. Some systems such as plugins that operate on their own clock may wish to ignore the filtered value and access the raw io value and read time but note that these values do not cause notifications when they change */ std::list<MachineInstance*>::iterator owners_iter = owners.begin(); while (owners_iter != owners.end()) { MachineInstance *o = *owners_iter++; o->properties.add("IOTIME", (long)read_time, SymbolTable::ST_REPLACE); o->properties.add("DurationTolerance", internals->rate_len, SymbolTable::ST_REPLACE); o->properties.add("VALUE", (long)scaled_val, SymbolTable::ST_REPLACE); o->properties.add("Position", (long)internals->last_sent, SymbolTable::ST_REPLACE); o->properties.add("Velocity", (long)internals->speeds.average(internals->speeds.length()), SymbolTable::ST_REPLACE); } #endif return internals->last_sent; }
/* * Verrà richiamato ad ogni Interrupt sul PIN specificato nel file config. */ void intRpm() { /* * Qui va inserito il codice da eseguire ogni qualvolta si verifica * l'interrupt RISING sul PIN specificato nel file di configurazione. */ rpmCount++; timeOfCapture = millis(); #ifndef PACK_SAMPLE addSample(); #endif }
VTestPlugin::VTestPlugin() :SamplePlugin("VTestPlugin") { // add the playpen tests addSample(new TextureBlitTest()); // addSample(new CubeMappingTest()); // no bg on Win // addSample(new ParticleTest()); // addSample(new StencilShadowTest()); // crashes on Windows; should show ogre head, barrel, taurus // addSample(new TextureEffectsTest()); // addSample(new TransparencyTest()); }
void TTraceRecorder::slotGpsData(const QWhereaboutsUpdate &update) { QMutexLocker locker(&_mutex); switch(_recordState) { case starting: if(createFile(update)) { _recordState = started; addSample(update); } else { _recordState = stopped; } break; case started: addSample(update); break; default: break; } }
VrmlNodeTextureSample::VrmlNodeTextureSample(const VrmlNodeTextureSample &n) : VrmlNodeTexture(n.d_scene) , d_sampleNum(n.d_sampleNum) , d_blendMode(n.d_blendMode) , d_repeatS(n.d_repeatS) , d_repeatT(n.d_repeatT) , d_environment(n.d_environment) , d_anisotropy(n.d_anisotropy) , d_filterMode(n.d_filterMode) , d_texObject(n.d_texObject) { pix = new unsigned char[width() * height() * 3]; addSample(this); }
VrmlNodeTextureSample::VrmlNodeTextureSample(VrmlScene *scene) : VrmlNodeTexture(scene) , d_sampleNum(0) , d_blendMode(0) , d_repeatS(true) , d_repeatT(true) , d_environment(false) , d_anisotropy(1) , d_filterMode(0) , d_texObject(0) { pix = new unsigned char[width() * height() * 3]; addSample(this); }
int32_t AnalogueInput::filter(int32_t raw) { if (config->property_changed) { config->property_changed = false; } addSample(config->positions, (long)read_time, (double)raw); if (config->filter_type && *config->filter_type == 0 ) { config->last_sent = raw; } else if ( !config->filter_type || (config->filter_type && *config->filter_type == 1)) { int32_t mean = (bufferAverage(config->positions, *config->filter_len) + 0.5f); long delta = abs(mean - config->last_sent); if ( delta >= *config->tolerance) { config->last_sent = mean; } } else if (config->filter_type && *config->filter_type == 2) { long res = (long)config->filter(); config->last_sent = (int32_t)(res / config->butterworth_len *2); } config->update(read_time); #if 1 /* most machines reading sensor values will be prompted when teh sensor value changes, depending on whether this filter yields a changed value. Some systems such as plugins that operate on their own clock may wish to ignore the filtered value and access the raw io value and read time but note that these values do not cause notifications when they change */ std::list<MachineInstance*>::iterator owners_iter = owners.begin(); while (owners_iter != owners.end()) { MachineInstance *o = *owners_iter++; o->properties.add("IOTIME", (long)read_time, SymbolTable::ST_REPLACE); o->properties.add("DurationTolerance", config->rate_len, SymbolTable::ST_REPLACE); o->properties.add("VALUE", (long)raw, SymbolTable::ST_REPLACE); o->properties.add("Position", (long)config->last_sent, SymbolTable::ST_REPLACE); double v = config->speeds.average(config->speeds.length()); if (fabs(v)<1.0) v = 0.0; o->properties.add("Velocity", (long)v, SymbolTable::ST_REPLACE); } #endif return config->last_sent; }
/* * main.c * Author: Kevin Cooper * Date: 16 Oct 13 * Description: Tests the MyMath functions to simulate the rolling average of several data points */ int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer int i ; avgArray_t test = buildMovingAverage(N_AVG_SAMPLES); int array[10] = {45, 42, 41, 40, 43, 45, 46, 47, 49, 45}; volatile int junk=0; for( i =0;i < 10;i++){ addSample(&test, array[i]); junk = movingAverage(&test); } junk = maxValue(&test); junk = minValue(&test); junk = range(&test); return 0; }
/******************************************************************************************* * Recursive method that fills in times and timeLine with the correct data from the file. * Takes in two pixel locations as endpoints and finds the timestamp that owns the pixel * in between these two. It then recursively calls itself twice - once with the beginning * location and the newfound location as endpoints and once with the newfound location * and the end location as endpoints. Effectively updates times and timeLine by calculating * the index in which to insert the next data. This way, it keeps times and timeLine sorted. * @author Reed Landrum and Michael Franco * @param minLoc The beginning location in the file to bound the search. * @param maxLoc The end location in the file to bound the search. * @param startPixel The beginning pixel in the image that corresponds to minLoc. * @param endPixel The end pixel in the image that corresponds to maxLoc. * @param minIndex An index used for calculating the index in which the data is to be inserted. * @return Returns the index that shows the size of the recursive subtree that has been read. * Used for calculating the index in which the data is to be inserted. ******************************************************************************************/ int TraceDataByRank::sampleTimeLine(FileOffset minLoc, FileOffset maxLoc, int startPixel, int endPixel, int minIndex, double pixelLength, Time startingTime) { int midPixel = (startPixel + endPixel) / 2; if (midPixel == startPixel) return 0; Long loc = findTimeInInterval((long)(midPixel * pixelLength + startingTime), minLoc, maxLoc); TimeCPID nextData = getData(loc); addSample(minIndex, nextData); int addedLeft = sampleTimeLine(minLoc, loc, startPixel, midPixel, minIndex, pixelLength, startingTime); int addedRight = sampleTimeLine(loc, maxLoc, midPixel, endPixel, minIndex + addedLeft + 1, pixelLength, startingTime); return (addedLeft + addedRight + 1); }
bool UnlabelledClassificationData::merge(UnlabelledClassificationData &unlabelledData) { if( unlabelledData.getNumDimensions() != numDimensions ) { errorLog << "merge(UnlabelledClassificationData &unlabelledData) - The number of dimensions in the unlabelledData (" << unlabelledData.getNumDimensions() << ") does not match the number of dimensions of this dataset (" << numDimensions << ")" << endl; return false; } //The dataset has changed so flag that any previous cross validation setup will now not work crossValidationSetup = false; crossValidationIndexs.clear(); //Add the data from the labelledData to this instance for(UINT i=0; i<unlabelledData.getNumSamples(); i++) { addSample( unlabelledData[i] ); } return true; }
void CrackDataSampler::execute() { std::vector<Real> values; for (unsigned int i=0; i<_domain_integral_postprocessor_values.size(); ++i) { values.clear(); const Point & crack_front_node = *_crack_front_definition->getCrackFrontNodePtr(i); Real position; if (_position_type == "Angle") position = _crack_front_definition->getAngleAlongFront(i); else position = _crack_front_definition->getDistanceAlongFront(i); values.push_back(*_domain_integral_postprocessor_values[i]); addSample(crack_front_node, position, values); } }
bool UnlabelledClassificationData::loadDatasetFromCSVFile(string filename) { string value; datasetName = "NOT_SET"; infoText = ""; //Clear any previous data clear(); //Parse the CSV file FileParser parser; if( !parser.parseCSVFile(filename,true) ) { errorLog << "loadDatasetFromCSVFile(string filename) - Failed to parse CSV file!" << endl; return false; } if( !parser.getConsistentColumnSize() ) { errorLog << "loadDatasetFromCSVFile(string filename) - The CSV file does not have a consistent number of columns!" << endl; return false; } //Setup the labelled classification data numDimensions = parser.getColumnSize(); VectorDouble sample(numDimensions); for(UINT i=0; i<parser.getRowSize(); i++) { //Get the input vector for(UINT j=0; j<numDimensions; j++) { sample[j] = Util::stringToDouble( parser[i][j] ); } //Add the labelled sample to the dataset if( !addSample(sample) ) { warningLog << "loadDatasetFromCSVFile(string filename) - Could not add sample " << i << " to the dataset!" << endl; } } return true; }
bool LabelledRegressionData::merge(const LabelledRegressionData ®ressionData){ if( regressionData.getNumInputDimensions() != numInputDimensions ){ errorLog << "merge(LabelledRegressionData ®ressionData) - The number of input dimensions in the regressionData (" << regressionData.getNumInputDimensions() << ") does not match the number of input dimensions of this dataset (" << numInputDimensions << ")" << endl; return false; } if( regressionData.getNumTargetDimensions() != numTargetDimensions ){ errorLog << "merge(LabelledRegressionData ®ressionData) - The number of target dimensions in the regressionData (" << regressionData.getNumTargetDimensions() << ") does not match the number of target dimensions of this dataset (" << numTargetDimensions << ")" << endl; return false; } //Add the data from the labelledData to this instance for(UINT i=0; i<regressionData.getNumSamples(); i++){ addSample(regressionData[i].getInputVector(), regressionData[i].getTargetVector()); } //The dataset has changed so flag that any previous cross validation setup will now not work crossValidationSetup = false; crossValidationIndexs.clear(); return true; }
bool TimeSeriesClassificationData::merge(const TimeSeriesClassificationData &labelledData){ if( labelledData.getNumDimensions() != numDimensions ){ errorLog << "merge(TimeSeriesClassificationData &labelledData) - The number of dimensions in the labelledData (" << labelledData.getNumDimensions() << ") does not match the number of dimensions of this dataset (" << numDimensions << ")" << endl; return false; } //The dataset has changed so flag that any previous cross validation setup will now not work crossValidationSetup = false; crossValidationIndexs.clear(); //Add the data from the labelledData to this instance for(UINT i=0; i<labelledData.getNumSamples(); i++){ addSample(labelledData[i].getClassLabel(), labelledData[i].getData()); } //Set the class names from the dataset vector< ClassTracker > classTracker = labelledData.getClassTracker(); for(UINT i=0; i<classTracker.size(); i++){ setClassNameForCorrespondingClassLabel(classTracker[i].className, classTracker[i].classLabel); } return true; }
void comp7to10() { initSamples("comp7to10"); setOutputDirectory("DelphesV07toV10"); int nbins; float low,high; TString var,xtitle; doOverflowAddition(true); doRatio_=false; setStackMode(false,false,false); //stack,norm,label override stackSignal_=false; selection_ = "(1)"; //no cuts! nbins=40; low=0; high=1000; var="MET"; xtitle="MET (GeV)"; // if (plotsToMake.Contains("all")||plotsToMake.Contains("001")) drawPlots(var,nbins,low,high,xtitle,"Events", "MET",0,"GeV"); nbins=40; low=0; high=2000; var="HT"; xtitle="HT (GeV)"; // if (plotsToMake.Contains("all")||plotsToMake.Contains("001")) drawPlots(var,nbins,low,high,xtitle,"Events", "HT",0,"GeV"); nbins=10; low=0; high=10; var="njets40"; xtitle=var; // if (plotsToMake.Contains("all")||plotsToMake.Contains("001")) drawPlots(var,nbins,low,high,xtitle,"Events", "njets40",0,"GeV"); //nbjets is not trivial to plot removeSample("tt-4p-0-600-v1510_14TEV_v10"); //plot only v07 savePlots_=false; nbins=4; low=0; high=4; var="nbjets40tight"; xtitle=var; // if (plotsToMake.Contains("all")||plotsToMake.Contains("002")) drawPlots(var,nbins,low,high,xtitle,"Events", var,0,""); TH1D* bjets_v07=(TH1D*) totalsm->Clone("bjets_v07"); addSample("tt-4p-0-600-v1510_14TEV_v10",kBlue,"v10 tt"); removeSample("tt-4p-0-600-v1510_14TEV_v07"); //plot only v10 var="nbjets40medium"; xtitle=var; // if (plotsToMake.Contains("all")||plotsToMake.Contains("002")) drawPlots(var,nbins,low,high,xtitle,"Events", var,0,""); TH1D* bjets_v10=(TH1D*) totalsm->Clone("bjets_v10"); renewCanvas(); bjets_v07->SetLineColor(kRed); bjets_v10->SetLineColor(kBlue); bjets_v10->Draw("e hist"); bjets_v07->Draw("e hist same"); thecanvas->SaveAs("DelphesV07toV10/bjets.pdf"); cout<<"Fraction of events in 0 b-tag bin (v07) = "<<bjets_v07->GetBinContent(1) / bjets_v07->Integral()<<endl; cout<<"Fraction of events in 0 b-tag bin (v10) = "<<bjets_v10->GetBinContent(1) / bjets_v10->Integral()<<endl; savePlots_=true; }