bool LabelledTimeSeriesClassificationData::printStats() const {
    
    cout << "DatasetName:\t" << datasetName << endl;
    cout << "DatasetInfo:\t" << infoText << endl;
    cout << "Number of Dimensions:\t" << numDimensions << endl;
    cout << "Number of Samples:\t" << totalNumSamples << endl;
    cout << "Number of Classes:\t" << getNumClasses() << endl;
    cout << "ClassStats:\n";
    
    for(UINT k=0; k<getNumClasses(); k++){
        cout << "ClassLabel:\t" << classTracker[k].classLabel;
        cout << "\tNumber of Samples:\t" << classTracker[k].counter;
        cout << "\tClassName:\t" << classTracker[k].className << endl;
    }
    
    vector< MinMax > ranges = getRanges();
    
    cout << "Dataset Ranges:\n";
    for(UINT j=0; j<ranges.size(); j++){
        cout << "[" << j+1 << "] Min:\t" << ranges[j].minValue << "\tMax: " << ranges[j].maxValue << endl;
    }
    
    cout << "Timeseries Lengths:\n";
    UINT M = (UINT)data.size();
    for(UINT j=0; j<M; j++){
        cout << "ClassLabel: " << data[j].getClassLabel() << " Length:\t" << data[j].getLength() << endl;
    }
    
    return true;
}
bool TimeSeriesClassificationDataStream::printStats() const {
    
    cout << "DatasetName:\t" << datasetName << endl;
    cout << "DatasetInfo:\t" << infoText << endl;
    cout << "Number of Dimensions:\t" << numDimensions << endl;
    cout << "Number of Samples:\t" << totalNumSamples << endl;
    cout << "Number of Classes:\t" << getNumClasses() << endl;
    cout << "ClassStats:\n";
    
    for(UINT k=0; k<getNumClasses(); k++){
        cout << "ClassLabel:\t" << classTracker[k].classLabel;
        cout << "\tNumber of Samples:\t" << classTracker[k].counter;
        cout << "\tClassName:\t" << classTracker[k].className << endl;
    }
    
    cout << "TimeSeriesMarkerStats:\n";
    for(UINT i=0; i<timeSeriesPositionTracker.size(); i++){
        cout << "ClassLabel: " << timeSeriesPositionTracker[i].getClassLabel();
        cout << "\tStartIndex: " << timeSeriesPositionTracker[i].getStartIndex();
        cout << "\tEndIndex: " << timeSeriesPositionTracker[i].getEndIndex();
        cout << "\tLength: " << timeSeriesPositionTracker[i].getLength() << endl;
    }
    
    vector< MinMax > ranges = getRanges();
    
    cout << "Dataset Ranges:\n";
    for(UINT j=0; j<ranges.size(); j++){
        cout << "[" << j+1 << "] Min:\t" << ranges[j].minValue << "\tMax: " << ranges[j].maxValue << endl;
    }
    
    return true;
}
std::string TimeSeriesClassificationData::getStatsAsString() const{
    
    std::string stats;
    
    stats += "DatasetName:\t" + datasetName + "\n";
    stats += "DatasetInfo:\t" + infoText + "\n";
    stats += "Number of Dimensions:\t" + Util::toString(numDimensions) + "\n";
    stats += "Number of Samples:\t" + Util::toString(totalNumSamples) + "\n";
    stats += "Number of Classes:\t" + Util::toString(getNumClasses()) + "\n";
    stats += "ClassStats:\n";
    
    for(UINT k=0; k<getNumClasses(); k++){
        stats += "ClassLabel:\t" + Util::toString(classTracker[k].classLabel);
        stats += "\tNumber of Samples:\t" + Util::toString( classTracker[k].counter );
        stats +="\tClassName:\t" + classTracker[k].className + "\n";
    }
    
    Vector< MinMax > ranges = getRanges();
    
    stats += "Dataset Ranges:\n";
    for(UINT j=0; j<ranges.size(); j++){
        stats += "[" + Util::toString( j+1 ) + "] Min:\t" + Util::toString( ranges[j].minValue ) + "\tMax: " + Util::toString( ranges[j].maxValue ) + "\n";
    }
    
    stats += "Timeseries Lengths:\n";
    UINT M = (UINT)data.size();
    for(UINT j=0; j<M; j++){
        stats += "ClassLabel: " + Util::toString( data[j].getClassLabel() ) + " Length:\t" + Util::toString( data[j].getLength() ) + "\n";
    }
    
    return stats;
}
bool MatrixDouble::scale(const double minTarget,const double maxTarget){
    
    if( dataPtr == NULL ) return false;
    
    vector< MinMax > ranges = getRanges();
    
    return scale(ranges,minTarget,maxTarget);
}
Esempio n. 5
0
bool MatrixFloat::scale(const Float minTarget,const Float maxTarget){
    
    if( dataPtr == NULL ) return false;
    
    Vector< MinMax > ranges = getRanges();
    
    return scale(ranges,minTarget,maxTarget);
}
Esempio n. 6
0
 vector<string> summaryRanges(vector<int>& nums) 
 {
     vector<int> ranges;
     vector<string> result;
     
     if(nums.size() == 0)
         return result;
     
     getRanges(nums, ranges);
     translate(ranges, result);
     
     return result;
 }
Esempio n. 7
0
	void TorsionalMinimisation::initRotations()
	{
		RotBond& rotbond = getWSpace().rotbond(); // local accessor for the duration of this function call
		if( rotbond.size() == 0 )
		{
			THROW(ProcedureException,"Procedural error during TorsionalMinimisation::initRotations(), the number of rotatable bonds is '0'!");
		}

		m_InitPickerSerial = getPickerSerial(); // we need to cache this - if the segment is changed, then runcore *MUST* recall initRotations()
		const PickAtomRanges& pickRanges = getRanges();
		m_BestStore.setPicking( getWSpace(), pickRanges );

		ChiRotDefs.clear();
		PhiPsiRotDefs.clear();

		const ParticleStore& atom = getWSpace().atom;

		// find out how many we have of each Type first...
		for( int i = 0; i < rotbond.size(); i++) // look in the rotatable bond array ...
		{
			bool matchFirst = pickRanges.matches( atom[rotbond[i].i] );
			if( !matchFirst ) continue;
			size_t firstMatchRange = pickRanges.getPreviousMatchRangeIndex();
			bool matchSecond = pickRanges.matches( atom[rotbond[i].j] );
			if( !matchSecond ) continue;
			size_t secondMatchRange = pickRanges.getPreviousMatchRangeIndex();
			if( firstMatchRange != secondMatchRange )
			{
				// rotbonds bridges range, we assume that there are dual-branch
				continue;
			}

			if( (rotbond[i].Type == RotatableBond::Single) )
			{
				if( (0 == (RotationExcldMode & ImproperSingles)) || // if 'Exclude ImproperSingles' isn't flagged
					!rotbond.isDelocalised(i) )
				{
					setupRotDefChi( rotbond[i] );
				}
			}
			else if( (rotbond[i].Type == RotatableBond::Phi) ||
				(rotbond[i].Type == RotatableBond::Psi) ||
				( (0 == (Omega &RotationExcldMode)) // exclude 'Omega' isn't flagged
				&& (rotbond[i].Type == RotatableBond::Omega))
				)
			{
				setupRotDefPhiPsi( rotbond[i], firstMatchRange );
			}
		}
	}
Esempio n. 8
0
File: range.cpp Progetto: jtb/RIVALS
  void Range::setChr(string chrom){
    recurse = stack<Cargo>();
    Capacity start;
    Capacity stop;
    if(getRanges(chrom, chrmap, start, stop)){
      on_chromosome = true;
      chr = chrom;
      cvector.setRange(offset, start, stop);
      Capacity root;
      if(getMidpoint(0, cvector.size(), root)){
	recurse.push(Cargo(0, cvector.size(), root));
      }
    }else{
      on_chromosome = false;
    }
  }
Esempio n. 9
0
MatrixFloat ClassificationData::getClassHistogramData(UINT classLabel,UINT numBins) const{

    const UINT M = getNumSamples();
    const UINT N = getNumDimensions();

    Vector< MinMax > ranges = getRanges();
    VectorFloat binRange(N);
    for(UINT i=0; i<ranges.size(); i++){
        binRange[i] = (ranges[i].maxValue-ranges[i].minValue)/Float(numBins);
    }

    MatrixFloat histData(N,numBins);
    histData.setAllValues(0);

    Float norm = 0;
    for(UINT i=0; i<M; i++){
        if( data[i].getClassLabel() == classLabel ){
            for(UINT j=0; j<N; j++){
                UINT binIndex = 0;
                bool binFound = false;
                for(UINT k=0; k<numBins-1; k++){
                    if( data[i][j] >= ranges[i].minValue + (binRange[j]*k) && data[i][j] >= ranges[i].minValue + (binRange[j]*(k+1)) ){
                        binIndex = k;
                        binFound = true;
                        break;
                    }
                }
                if( !binFound ) binIndex = numBins-1;
                histData[j][binIndex]++;
            }
            norm++;
        }
    }

    if( norm == 0 ) return histData;

    //Is this the best way to normalize a multidimensional histogram???
    for(UINT i=0; i<histData.getNumRows(); i++){
        for(UINT j=0; j<histData.getNumCols(); j++){
            histData[i][j] /= norm;
        }
    }

    return histData;
}
Esempio n. 10
0
KFontProperties::KFontProperties(const TTF_Font *_Font, const KFile *file, int ptSize) :
fontPath(file->getAbsolutePath().c_str()),
familyName(TTF_FontFaceFamilyName(_Font)),
styleName(TTF_FontFaceStyleName(_Font)),
ttf_Style(TTF_GetFontStyle(_Font)),
height(TTF_FontHeight(_Font)),
ascent(TTF_FontAscent(_Font)),
descent(TTF_FontDescent(_Font)),
lineSkip(TTF_FontLineSkip(_Font)),
faces(TTF_FontFaces(_Font)),
monospace(TTF_FontFaceIsFixedWidth(_Font)),
firstGlyph(getFirstGlyph(_Font)),
lastGlyph(getLastGlyph(_Font)),
totalGlyphs(getTotalGlyphs(_Font)),
glyphRanges(getRanges(_Font)),
pointSize(ptSize) {

}
Esempio n. 11
0
int main (int *argc, char **argv) {
  char *tab;
  char *accession;

  SRAMgr const *sra;
  SRATable const *tbl;
  spotid_t nspots;
  rc_t rc;

  tab = argv[1];
  accession = argv[2];

  rc = openTable(tab, &sra, &tbl, &nspots);
  if (rc != 0) {
    return rc;
  }
  printf("There are %d spots\n", nspots);

  //  rc = getReads(tbl, accession, 10);
  rc = getBases(tbl, 1, 10);
  if (rc != 0) {
    closeTable(sra, tbl);
    return 1;
  }

  printf("\n");
  rc = getQuals(tbl, 1, 10);
  if (rc != 0) {
    closeTable(sra, tbl);
    return 1;
  }

  getInfo(tbl, 1, 10);
  getRanges(tbl);
  closeTable(sra, tbl);
  return 0;
}
string LabelledClassificationData::getStatsAsString() const{
    string statsText;
    statsText += "DatasetName:\t" + datasetName + "\n";
    statsText += "DatasetInfo:\t" + infoText + "\n";
    statsText += "Number of Dimensions:\t" + Util::toString( numDimensions ) + "\n";
    statsText += "Number of Samples:\t" + Util::toString( totalNumSamples ) + "\n";
    statsText += "Number of Classes:\t" + Util::toString( getNumClasses() ) + "\n";
    statsText += "ClassStats:\n";

    for(UINT k=0; k<getNumClasses(); k++){
        statsText += "ClassLabel:\t" + Util::toString( classTracker[k].classLabel );
        statsText += "\tNumber of Samples:\t" + Util::toString(classTracker[k].counter);
        statsText += "\tClassName:\t" + classTracker[k].className + "\n";
    }

    vector< MinMax > ranges = getRanges();

    statsText += "Dataset Ranges:\n";
    for(UINT j=0; j<ranges.size(); j++){
        statsText += "[" + Util::toString( j+1 ) + "] Min:\t" + Util::toString( ranges[j].minValue ) + "\tMax: " + Util::toString( ranges[j].maxValue ) + "\n";
    }

    return statsText;
}
Esempio n. 13
0
bool ClassificationData::scale(const double minTarget,const double maxTarget){
    vector< MinMax > ranges = getRanges();
    return scale(ranges,minTarget,maxTarget);
}
Esempio n. 14
0
void MtxLP::getOptRanges(rangemap* rm, OBJSTAT &objrange, stomap* obj, strvec q, bool presolve){
    fixSolution(obj, true, true, true, presolve);
    getObjStat(objrange);
    getRanges(rm, q, presolve);
    cleanTmpRows(obj->size());
}
bool TimeSeriesClassificationData::scale(const Float minTarget,const Float maxTarget){
    Vector< MinMax > ranges = getRanges();
    return scale(ranges,minTarget,maxTarget);
}
bool LabelledClassificationData::scale(double minTarget,double maxTarget){
    vector< MinMax > ranges = getRanges();
    return scale(ranges,minTarget,maxTarget);
}
Esempio n. 17
0
DOMNode *XPathDocumentImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
{
    // if the newChild is a documenttype node created from domimplementation, set the ownerDoc first
    if ((newChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE) && !newChild->getOwnerDocument())
        ((DOMDocumentTypeImpl*)newChild)->setOwnerDocument(this);

    if(newChild==NULL)
        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, getMemoryManager());

    DOMNodeImpl *thisNodeImpl = castToNodeImpl(this);
    if (thisNodeImpl->isReadOnly())
        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, getMemoryManager());

    DOMNode* thisNode = castToNode(&fParent);
    if (newChild->getOwnerDocument() != thisNode)
        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, getMemoryManager());

    // refChild must in fact be a child of this node (or 0)
    if (refChild!=0 && refChild->getParentNode() != thisNode)
        throw DOMException(DOMException::NOT_FOUND_ERR,0, getMemoryManager());

    // if the new node has to be placed before itself, we don't have to do anything 
    // (even worse, we would crash if we continue, as we assume they are two distinct nodes)
    if (refChild!=0 && newChild->isSameNode(refChild))
        return newChild;

    if (newChild->getNodeType() == DOMNode::DOCUMENT_FRAGMENT_NODE)
    {
        // SLOW BUT SAFE: We could insert the whole subtree without
        // juggling so many next/previous pointers. (Wipe out the
        // parent's child-list, patch the parent pointers, set the
        // ends of the list.) But we know some subclasses have special-
        // case behavior they add to insertBefore(), so we don't risk it.
        // This approch also takes fewer bytecodes.

        while(newChild->hasChildNodes())     // Move
            insertBefore(newChild->getFirstChild(),refChild);
    }

    else
    {
        DOMNode *oldparent=newChild->getParentNode();
        if(oldparent!=0)
            oldparent->removeChild(newChild);

        // Attach up
        castToNodeImpl(newChild)->fOwnerNode = thisNode;
        castToNodeImpl(newChild)->isOwned(true);

        // Attach before and after
        // Note: fFirstChild.previousSibling == lastChild!!
        if (fParent.fFirstChild == 0) {
            // this our first and only child
            fParent.fFirstChild = newChild;
            castToNodeImpl(newChild)->isFirstChild(true);
            // castToChildImpl(newChild)->previousSibling = newChild;
            DOMChildNode *newChild_ci = castToChildImpl(newChild);
            newChild_ci->previousSibling = newChild;
        } else {
            if (refChild == 0) {
                // this is an append
                DOMNode *lastChild = castToChildImpl(fParent.fFirstChild)->previousSibling;
                castToChildImpl(lastChild)->nextSibling = newChild;
                castToChildImpl(newChild)->previousSibling = lastChild;
                castToChildImpl(fParent.fFirstChild)->previousSibling = newChild;
            } else {
                // this is an insert
                if (refChild == fParent.fFirstChild) {
                    // at the head of the list
                    castToNodeImpl(fParent.fFirstChild)->isFirstChild(false);
                    castToChildImpl(newChild)->nextSibling = fParent.fFirstChild;
                    castToChildImpl(newChild)->previousSibling = castToChildImpl(fParent.fFirstChild)->previousSibling;
                    castToChildImpl(fParent.fFirstChild)->previousSibling = newChild;
                    fParent.fFirstChild = newChild;
                    castToNodeImpl(newChild)->isFirstChild(true);
                } else {
                    // somewhere in the middle
                    DOMNode *prev = castToChildImpl(refChild)->previousSibling;
                    castToChildImpl(newChild)->nextSibling = refChild;
                    castToChildImpl(prev)->nextSibling = newChild;
                    castToChildImpl(refChild)->previousSibling = newChild;
                    castToChildImpl(newChild)->previousSibling = prev;
                }
            }
        }
    }

    changed();

    Ranges* ranges = getRanges();
    if ( ranges != 0) {
        XMLSize_t sz = ranges->size();
        if (sz != 0) {
            for (XMLSize_t i =0; i<sz; i++) {
                ranges->elementAt(i)->updateRangeForInsertedNode(newChild);
            }
        }
    }

    // If insert succeeded, cache the kid appropriately
    if(newChild->getNodeType() == DOMNode::ELEMENT_NODE)
        fMyDocElement=(DOMElement *)newChild;
    else if(newChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE)
        fMyDocType=(DOMDocumentType *)newChild;

    return newChild;
}
bool NTHistogram::isValid()
{
    return (getValue()->getLength()+1 == getRanges()->getLength());
}