idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
33,500 | private static void drawLine ( int x0 , int y0 , int x1 , int y1 , boolean [ ] [ ] pic ) { final int xres = pic . length , yres = pic [ 0 ] . length ; y0 = ( y0 < 0 ) ? 0 : ( y0 >= yres ) ? ( yres - 1 ) : y0 ; y1 = ( y1 < 0 ) ? 0 : ( y1 >= yres ) ? ( yres - 1 ) : y1 ; x0 = ( x0 < 0 ) ? 0 : ( x0 >= xres ) ? ( xres - 1 )... | Draw a line onto the array using the classic Bresenham algorithm . |
33,501 | public Collection < String > getPossibleValues ( ) { final E [ ] enums = enumClass . getEnumConstants ( ) ; ArrayList < String > values = new ArrayList < > ( enums . length ) ; for ( E t : enums ) { values . add ( t . name ( ) ) ; } return values ; } | Get a list of possible values for this enum parameter . |
33,502 | private String joinEnumNames ( String separator ) { E [ ] enumTypes = enumClass . getEnumConstants ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < enumTypes . length ; ++ i ) { if ( i > 0 ) { sb . append ( separator ) ; } sb . append ( enumTypes [ i ] . name ( ) ) ; } return sb . toString ( ) ; } | Utility method for merging possible values into a string for informational messages . |
33,503 | protected void preInsert ( MkMaxEntry entry ) { KNNHeap knns_o = DBIDUtil . newHeap ( getKmax ( ) ) ; preInsert ( entry , getRootEntry ( ) , knns_o ) ; } | Adapts the knn distances before insertion of the specified entry . |
33,504 | public static IntIterator getCommonDimensions ( Collection < SplitHistory > splitHistories ) { Iterator < SplitHistory > it = splitHistories . iterator ( ) ; long [ ] checkSet = BitsUtil . copy ( it . next ( ) . dimBits ) ; while ( it . hasNext ( ) ) { SplitHistory sh = it . next ( ) ; BitsUtil . andI ( checkSet , sh .... | Get the common split dimensions from a list of split histories . |
33,505 | public static Filter handleURL ( ParsedURL url ) { if ( LOG . isDebuggingFiner ( ) ) { LOG . debugFiner ( "handleURL " + url . toString ( ) ) ; } if ( ! isCompatibleURLStatic ( url ) ) { return null ; } int id ; try { id = ParseUtil . parseIntBase10 ( url . getPath ( ) ) ; } catch ( NumberFormatException e ) { return n... | Statically handle the URL access . |
33,506 | public static int globalCentroid ( Centroid overallCentroid , Relation < ? extends NumberVector > rel , List < ? extends Cluster < ? > > clusters , NumberVector [ ] centroids , NoiseHandling noiseOption ) { int clustercount = 0 ; Iterator < ? extends Cluster < ? > > ci = clusters . iterator ( ) ; for ( int i = 0 ; ci .... | Update the global centroid . |
33,507 | public DBID findPrototype ( DBIDs members ) { DBIDIter it = members . iter ( ) ; DBIDVar proto = DBIDUtil . newVar ( it ) , last = DBIDUtil . newVar ( it ) ; int maxprio = Integer . MIN_VALUE , secprio = Integer . MIN_VALUE ; for ( ; it . valid ( ) ; it . advance ( ) ) { int prio = mergeOrder . intValue ( it ) ; if ( p... | Extract the prototype of a given cluster . When the argument is not a valid cluster of this Pointer Hierarchy the return value is unspecified . |
33,508 | public void bulkLoad ( DBIDs ids ) { if ( ids . size ( ) == 0 ) { return ; } assert ( root == null ) : "Tree already initialized." ; DBIDIter it = ids . iter ( ) ; DBID first = DBIDUtil . deref ( it ) ; ModifiableDoubleDBIDList candidates = DBIDUtil . newDistanceDBIDList ( ids . size ( ) - 1 ) ; for ( it . advance ( ) ... | Bulk - load the index . |
33,509 | private void checkCoverTree ( Node cur , int [ ] counts , int depth ) { counts [ 0 ] += 1 ; counts [ 1 ] += depth ; counts [ 2 ] = depth > counts [ 2 ] ? depth : counts [ 2 ] ; counts [ 3 ] += cur . singletons . size ( ) - 1 ; counts [ 4 ] += cur . singletons . size ( ) - ( cur . children == null ? 0 : 1 ) ; if ( cur .... | Collect some statistics on the tree . |
33,510 | protected void addToStatistics ( NumberVector nv ) { final int d = nv . getDimensionality ( ) ; assert ( d == ls . length ) ; this . n ++ ; for ( int i = 0 ; i < d ; i ++ ) { double v = nv . doubleValue ( i ) ; ls [ i ] += v ; ss += v * v ; } } | Add a number vector to the current node . |
33,511 | protected void addToStatistics ( ClusteringFeature other ) { n += other . n ; VMath . plusEquals ( ls , other . ls ) ; ss += other . ss ; } | Merge an other clustering features . |
33,512 | public double sumOfSquaresOfSums ( ) { double sum = 0. ; for ( int i = 0 ; i < ls . length ; i ++ ) { double v = ls [ i ] ; sum += v * v ; } return sum ; } | Sum over all dimensions of squares of linear sums . |
33,513 | public static double sumOfSquares ( NumberVector v ) { final int dim = v . getDimensionality ( ) ; double sum = 0 ; for ( int d = 0 ; d < dim ; d ++ ) { double x = v . doubleValue ( d ) ; sum += x * x ; } return sum ; } | Compute the sum of squares of a vector . |
33,514 | private static void insertionSort ( int [ ] data , final int start , final int end , IntComparator comp ) { for ( int i = start + 1 ; i < end ; i ++ ) { final int cur = data [ i ] ; int j = i - 1 ; while ( j >= start ) { final int pre = data [ j ] ; if ( comp . compare ( cur , pre ) >= 0 ) { break ; } data [ j + 1 ] = ... | Insertion sort for short arrays . |
33,515 | public double [ ] [ ] processIds ( DBIDs ids , Relation < ? extends NumberVector > relation ) { final int dim = RelationUtil . dimensionality ( relation ) ; final CovarianceMatrix cmat = new CovarianceMatrix ( dim ) ; final Centroid centroid = Centroid . make ( relation , ids ) ; double maxdist = 0.0 , stddev = 0.0 ; {... | Weighted Covariance Matrix for a set of IDs . Since we are not supplied any distance information we ll need to compute it ourselves . Covariance is tied to Euclidean distance so it probably does not make much sense to add support for other distance functions? |
33,516 | public double [ ] [ ] processQueryResults ( DoubleDBIDList results , Relation < ? extends NumberVector > database , int k ) { final int dim = RelationUtil . dimensionality ( database ) ; final CovarianceMatrix cmat = new CovarianceMatrix ( dim ) ; k = k <= results . size ( ) ? k : results . size ( ) ; double maxdist = ... | Compute Covariance Matrix for a QueryResult Collection . |
33,517 | public Instance instantiate ( Database database , Relation < V > relation ) { DistanceQuery < V > dq = database . getDistanceQuery ( relation , EuclideanDistanceFunction . STATIC ) ; KNNQuery < V > knnq = database . getKNNQuery ( dq , settings . k ) ; WritableDataStore < PCAFilteredResult > storage = DataStoreUtil . ma... | Full instantiation interface . |
33,518 | public static void writeXHTML ( Document htmldoc , OutputStream out ) throws IOException { javax . xml . transform . Result result = new StreamResult ( out ) ; Transformer xformer ; try { xformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; xformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; ... | Write an HTML document to an output stream . |
33,519 | public static Element appendMultilineText ( Document htmldoc , Element parent , String text ) { String [ ] parts = text != null ? text . split ( "\n" ) : null ; if ( parts == null || parts . length == 0 ) { return parent ; } parent . appendChild ( htmldoc . createTextNode ( parts [ 0 ] ) ) ; for ( int i = 1 ; i < parts... | Append a multiline text to a node transforming linewraps into BR tags . |
33,520 | public int getPathCount ( ) { int result = 0 ; for ( IndexTreePath < E > path = this ; path != null ; path = path . parentPath ) { result ++ ; } return result ; } | Returns the number of elements in the path . |
33,521 | public OutlierResult run ( Database database , Relation < O > relation ) { StepProgress stepprog = LOG . isVerbose ( ) ? new StepProgress ( "CBLOF" , 3 ) : null ; DBIDs ids = relation . getDBIDs ( ) ; LOG . beginStep ( stepprog , 1 , "Computing clustering." ) ; Clustering < MeanModel > clustering = clusteringAlgorithm ... | Runs the CBLOF algorithm on the given database . |
33,522 | private int getClusterBoundary ( Relation < O > relation , List < ? extends Cluster < MeanModel > > clusters ) { int totalSize = relation . size ( ) ; int clusterBoundary = clusters . size ( ) - 1 ; int cumulativeSize = 0 ; for ( int i = 0 ; i < clusters . size ( ) - 1 ; i ++ ) { cumulativeSize += clusters . get ( i ) ... | Compute the boundary index separating the large cluster from the small cluster . |
33,523 | private void computeCBLOFs ( Relation < O > relation , NumberVectorDistanceFunction < ? super O > distance , WritableDoubleDataStore cblofs , DoubleMinMax cblofMinMax , List < ? extends Cluster < MeanModel > > largeClusters , List < ? extends Cluster < MeanModel > > smallClusters ) { List < NumberVector > largeClusterM... | Compute the CBLOF scores for all the data . |
33,524 | private GeneratorMain loadXMLSpecification ( ) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; dbf . setFeature ( "http://apache.org/xml/features/nonvalidating/load-external-dtd" , false ) ; URL url = ClassLoader . getSystemResource ( GENERATOR_SCHEMA_FILE ) ; if ( url != null ) { try { ... | Load the XML configuration file . |
33,525 | private void processElementDataset ( GeneratorMain gen , Node cur ) { String seedstr = ( ( Element ) cur ) . getAttribute ( ATTR_SEED ) ; if ( clusterRandom != RandomFactory . DEFAULT && seedstr != null && seedstr . length ( ) > 0 ) { clusterRandom = new RandomFactory ( ( long ) ( ParseUtil . parseIntBase10 ( seedstr )... | Process a dataset Element in the XML stream . |
33,526 | private void processElementCluster ( GeneratorMain gen , Node cur ) { int size = - 1 ; double overweight = 1.0 ; String sizestr = ( ( Element ) cur ) . getAttribute ( ATTR_SIZE ) ; if ( sizestr != null && sizestr . length ( ) > 0 ) { size = ( int ) ( ParseUtil . parseIntBase10 ( sizestr ) * sizescale ) ; } String name ... | Process a cluster Element in the XML stream . |
33,527 | private void processElementUniform ( GeneratorSingleCluster cluster , Node cur ) { double min = 0.0 ; double max = 1.0 ; String minstr = ( ( Element ) cur ) . getAttribute ( ATTR_MIN ) ; if ( minstr != null && minstr . length ( ) > 0 ) { min = ParseUtil . parseDouble ( minstr ) ; } String maxstr = ( ( Element ) cur ) .... | Process a uniform Element in the XML stream . |
33,528 | private void processElementNormal ( GeneratorSingleCluster cluster , Node cur ) { double mean = 0.0 ; double stddev = 1.0 ; String meanstr = ( ( Element ) cur ) . getAttribute ( ATTR_MEAN ) ; if ( meanstr != null && meanstr . length ( ) > 0 ) { mean = ParseUtil . parseDouble ( meanstr ) ; } String stddevstr = ( ( Eleme... | Process a normal Element in the XML stream . |
33,529 | private void processElementGamma ( GeneratorSingleCluster cluster , Node cur ) { double k = 1.0 ; double theta = 1.0 ; String kstr = ( ( Element ) cur ) . getAttribute ( ATTR_K ) ; if ( kstr != null && kstr . length ( ) > 0 ) { k = ParseUtil . parseDouble ( kstr ) ; } String thetastr = ( ( Element ) cur ) . getAttribut... | Process a gamma Element in the XML stream . |
33,530 | private void processElementRotate ( GeneratorSingleCluster cluster , Node cur ) { int axis1 = 0 ; int axis2 = 0 ; double angle = 0.0 ; String a1str = ( ( Element ) cur ) . getAttribute ( ATTR_AXIS1 ) ; if ( a1str != null && a1str . length ( ) > 0 ) { axis1 = ParseUtil . parseIntBase10 ( a1str ) ; } String a2str = ( ( E... | Process a rotate Element in the XML stream . |
33,531 | private void processElementTranslate ( GeneratorSingleCluster cluster , Node cur ) { double [ ] offset = null ; String vstr = ( ( Element ) cur ) . getAttribute ( ATTR_VECTOR ) ; if ( vstr != null && vstr . length ( ) > 0 ) { offset = parseVector ( vstr ) ; } if ( offset == null ) { throw new AbortException ( "No trans... | Process a translate Element in the XML stream . |
33,532 | private void processElementClipping ( GeneratorSingleCluster cluster , Node cur ) { double [ ] cmin = null , cmax = null ; String minstr = ( ( Element ) cur ) . getAttribute ( ATTR_MIN ) ; if ( minstr != null && minstr . length ( ) > 0 ) { cmin = parseVector ( minstr ) ; } String maxstr = ( ( Element ) cur ) . getAttri... | Process a clipping Element in the XML stream . |
33,533 | private void processElementStatic ( GeneratorMain gen , Node cur ) { String name = ( ( Element ) cur ) . getAttribute ( ATTR_NAME ) ; if ( name == null ) { throw new AbortException ( "No cluster name given in specification file." ) ; } ArrayList < double [ ] > points = new ArrayList < > ( ) ; XMLNodeIterator iter = new... | Process a static cluster Element in the XML stream . |
33,534 | private double [ ] parseVector ( String s ) { String [ ] entries = WHITESPACE_PATTERN . split ( s ) ; double [ ] d = new double [ entries . length ] ; for ( int i = 0 ; i < entries . length ; i ++ ) { try { d [ i ] = ParseUtil . parseDouble ( entries [ i ] ) ; } catch ( NumberFormatException e ) { throw new AbortExcept... | Parse a string into a vector . |
33,535 | public static NumberVector getPrototype ( Model model , Relation < ? extends NumberVector > relation ) { if ( model instanceof MeanModel ) { return DoubleVector . wrap ( ( ( MeanModel ) model ) . getMean ( ) ) ; } if ( model instanceof MedoidModel ) { return relation . get ( ( ( MedoidModel ) model ) . getMedoid ( ) ) ... | Get the representative vector for a cluster model . |
33,536 | private long [ ] determinePreferenceVectorByApriori ( Relation < V > relation , ModifiableDBIDs [ ] neighborIDs , StringBuilder msg ) { int dimensionality = neighborIDs . length ; UpdatableDatabase apriori_db = new HashmapDatabase ( ) ; SimpleTypeInformation < ? > bitmeta = VectorFieldTypeInformation . typeRequest ( Bi... | Determines the preference vector with the apriori strategy . |
33,537 | private long [ ] determinePreferenceVectorByMaxIntersection ( ModifiableDBIDs [ ] neighborIDs , StringBuilder msg ) { int dimensionality = neighborIDs . length ; long [ ] preferenceVector = BitsUtil . zero ( dimensionality ) ; Map < Integer , ModifiableDBIDs > candidates = new HashMap < > ( dimensionality ) ; for ( int... | Determines the preference vector with the max intersection strategy . |
33,538 | private int max ( Map < Integer , ModifiableDBIDs > candidates ) { int maxDim = - 1 , size = - 1 ; for ( Integer nextDim : candidates . keySet ( ) ) { int nextSet = candidates . get ( nextDim ) . size ( ) ; if ( size < nextSet ) { size = nextSet ; maxDim = nextDim ; } } return maxDim ; } | Returns the set with the maximum size contained in the specified map . |
33,539 | private int maxIntersection ( Map < Integer , ModifiableDBIDs > candidates , ModifiableDBIDs set ) { int maxDim = - 1 ; ModifiableDBIDs maxIntersection = null ; for ( Integer nextDim : candidates . keySet ( ) ) { DBIDs nextSet = candidates . get ( nextDim ) ; ModifiableDBIDs nextIntersection = DBIDUtil . intersection (... | Returns the index of the set having the maximum intersection set with the specified set contained in the specified map . |
33,540 | private RangeQuery < V > [ ] initRangeQueries ( Relation < V > relation , int dimensionality ) { @ SuppressWarnings ( "unchecked" ) RangeQuery < V > [ ] rangeQueries = ( RangeQuery < V > [ ] ) new RangeQuery [ dimensionality ] ; for ( int d = 0 ; d < dimensionality ; d ++ ) { rangeQueries [ d ] = relation . getRangeQue... | Initializes the dimension selecting distancefunctions to determine the preference vectors . |
33,541 | @ Reference ( authors = "F. J. Rohlf" , title = "Methods of comparing classifications" , booktitle = "Annual Review of Ecology and Systematics" , url = "https://doi.org/10.1146/annurev.es.05.110174.000533" , bibkey = "doi:10.1146/annurev.es.05.110174.000533" ) public double computeTau ( long c , long d , double m , lon... | Compute the Tau correlation measure |
33,542 | public void checkServices ( String update ) { TreeSet < String > props = new TreeSet < > ( ) ; Enumeration < URL > us ; try { us = getClass ( ) . getClassLoader ( ) . getResources ( ELKIServiceLoader . RESOURCE_PREFIX ) ; } catch ( IOException e ) { throw new AbortException ( "Error enumerating service folders." , e ) ... | Retrieve all properties and check them . |
33,543 | @ SuppressWarnings ( "unchecked" ) private void checkAliases ( Class < ? > parent , String classname , String [ ] parts ) { Class < ? > c = ELKIServiceRegistry . findImplementation ( ( Class < Object > ) parent , classname ) ; if ( c == null ) { return ; } Alias ann = c . getAnnotation ( Alias . class ) ; if ( ann == n... | Check if aliases are listed completely . |
33,544 | public LinearEquationSystem getNormalizedLinearEquationSystem ( Normalization < ? > normalization ) throws NonNumericFeaturesException { if ( normalization != null ) { LinearEquationSystem lq = normalization . transform ( linearEquationSystem ) ; lq . solveByTotalPivotSearch ( ) ; return lq ; } else { return linearEqua... | Returns the linear equation system for printing purposes . If normalization is null the linear equation system is returned otherwise the linear equation system will be transformed according to the normalization . |
33,545 | public double squaredDistance ( V p ) { double [ ] p_minus_a = minusEquals ( p . toArray ( ) , centroid ) ; return squareSum ( minusEquals ( p_minus_a , times ( strongEigenvectors , transposeTimes ( strongEigenvectors , p_minus_a ) ) ) ) ; } | Returns the distance of NumberVector p from the hyperplane underlying this solution . |
33,546 | public double [ ] errorVector ( V p ) { return weakEigenvectors . length > 0 ? times ( weakEigenvectors , transposeTimes ( weakEigenvectors , minusEquals ( p . toArray ( ) , centroid ) ) ) : EMPTY_VECTOR ; } | Returns the error vectors after projection . |
33,547 | public double [ ] dataVector ( V p ) { return strongEigenvectors . length > 0 ? times ( strongEigenvectors , transposeTimes ( strongEigenvectors , minusEquals ( p . toArray ( ) , centroid ) ) ) : EMPTY_VECTOR ; } | Returns the data vectors after projection . |
33,548 | public void writeToText ( TextWriterStream out , String label ) { if ( label != null ) { out . commentPrintLn ( label ) ; } out . commentPrintLn ( "Model class: " + this . getClass ( ) . getName ( ) ) ; try { if ( getNormalizedLinearEquationSystem ( null ) != null ) { LinearEquationSystem lq = getNormalizedLinearEquati... | Text output of the equation system |
33,549 | protected int getBinNr ( double coord ) { if ( Double . isInfinite ( coord ) || Double . isNaN ( coord ) ) { throw new UnsupportedOperationException ( "Encountered non-finite value in Histogram: " + coord ) ; } if ( coord == max ) { return size - 1 ; } return ( int ) Math . floor ( ( coord - base ) / binsize ) + offset... | Compute the bin number . Has a special case for rounding max down to the last bin . |
33,550 | protected static int growSize ( int current , int requiredSize ) { int newCapacity = ( ( current < 64 ) ? ( ( current + 1 ) << 1 ) : ( ( current >> 1 ) * 3 ) ) ; if ( newCapacity < 0 ) { throw new OutOfMemoryError ( ) ; } if ( requiredSize > newCapacity ) { newCapacity = requiredSize ; } return requiredSize ; } | Compute the size to grow to . |
33,551 | private void expandNodes ( DeLiCluTree index , SpatialPrimitiveDistanceFunction < V > distFunction , SpatialObjectPair nodePair , DataStore < KNNList > knns ) { DeLiCluNode node1 = index . getNode ( ( ( SpatialDirectoryEntry ) nodePair . entry1 ) . getPageID ( ) ) ; DeLiCluNode node2 = index . getNode ( ( ( SpatialDire... | Expands the spatial nodes of the specified pair . |
33,552 | private void expandDirNodes ( SpatialPrimitiveDistanceFunction < V > distFunction , DeLiCluNode node1 , DeLiCluNode node2 ) { if ( LOG . isDebuggingFinest ( ) ) { LOG . debugFinest ( "ExpandDirNodes: " + node1 . getPageID ( ) + " + " + node2 . getPageID ( ) ) ; } int numEntries_1 = node1 . getNumEntries ( ) ; int numEn... | Expands the specified directory nodes . |
33,553 | private void expandLeafNodes ( SpatialPrimitiveDistanceFunction < V > distFunction , DeLiCluNode node1 , DeLiCluNode node2 , DataStore < KNNList > knns ) { if ( LOG . isDebuggingFinest ( ) ) { LOG . debugFinest ( "ExpandLeafNodes: " + node1 . getPageID ( ) + " + " + node2 . getPageID ( ) ) ; } int numEntries_1 = node1 ... | Expands the specified leaf nodes . |
33,554 | private void reinsertExpanded ( SpatialPrimitiveDistanceFunction < V > distFunction , DeLiCluTree index , IndexTreePath < DeLiCluEntry > path , DataStore < KNNList > knns ) { int l = 0 ; for ( IndexTreePath < DeLiCluEntry > it = path ; it != null ; it = it . getParentPath ( ) ) { l ++ ; } ArrayList < IndexTreePath < De... | Reinserts the objects of the already expanded nodes . |
33,555 | public static int assertSameDimensionality ( SpatialComparable box1 , SpatialComparable box2 ) { final int dim = box1 . getDimensionality ( ) ; if ( dim != box2 . getDimensionality ( ) ) { throw new IllegalArgumentException ( "The spatial objects do not have the same dimensionality!" ) ; } return dim ; } | Check that two spatial objects have the same dimensionality . |
33,556 | public static double [ ] getMin ( SpatialComparable box ) { final int dim = box . getDimensionality ( ) ; double [ ] min = new double [ dim ] ; for ( int i = 0 ; i < dim ; i ++ ) { min [ i ] = box . getMin ( i ) ; } return min ; } | Returns a clone of the minimum hyper point . |
33,557 | public static double [ ] getMax ( SpatialComparable box ) { final int dim = box . getDimensionality ( ) ; double [ ] max = new double [ dim ] ; for ( int i = 0 ; i < dim ; i ++ ) { max [ i ] = box . getMax ( i ) ; } return max ; } | Returns a clone of the maximum hyper point . |
33,558 | public static boolean intersects ( SpatialComparable box1 , SpatialComparable box2 ) { final int dim = assertSameDimensionality ( box1 , box2 ) ; for ( int i = 0 ; i < dim ; i ++ ) { if ( box2 . getMax ( i ) < box1 . getMin ( i ) || box1 . getMax ( i ) < box2 . getMin ( i ) ) { return false ; } } return true ; } | Returns true if the two SpatialComparables intersect false otherwise . |
33,559 | public static boolean contains ( SpatialComparable box , double [ ] point ) { final int dim = box . getDimensionality ( ) ; if ( dim != point . length ) { throw new IllegalArgumentException ( "This HyperBoundingBox and the given point need same dimensionality" ) ; } for ( int i = 0 ; i < dim ; i ++ ) { if ( box . getMi... | Returns true if this SpatialComparable contains the given point false otherwise . |
33,560 | public static double enlargement ( SpatialComparable exist , SpatialComparable addit ) { final int dim = assertSameDimensionality ( exist , addit ) ; double v1 = 1. ; double v2 = 1. ; for ( int i = 0 ; i < dim ; i ++ ) { final double emin = exist . getMin ( i ) ; final double emax = exist . getMax ( i ) ; final double ... | Compute the enlargement obtained by adding an object to an existing object . |
33,561 | public static double perimeter ( SpatialComparable box ) { final int dim = box . getDimensionality ( ) ; double perimeter = 0. ; for ( int i = 0 ; i < dim ; i ++ ) { perimeter += box . getMax ( i ) - box . getMin ( i ) ; } return perimeter ; } | Computes the perimeter of this SpatialComparable . |
33,562 | public static double overlap ( SpatialComparable box1 , SpatialComparable box2 ) { final int dim = assertSameDimensionality ( box1 , box2 ) ; double omax , omin ; double overlap = 1. ; for ( int i = 0 ; i < dim ; i ++ ) { omax = Math . min ( box1 . getMax ( i ) , box2 . getMax ( i ) ) ; omin = Math . max ( box1 . getMi... | Computes the volume of the overlapping box between two SpatialComparables . |
33,563 | public static double relativeOverlap ( SpatialComparable box1 , SpatialComparable box2 ) { final int dim = assertSameDimensionality ( box1 , box2 ) ; double overlap = 1. ; double vol1 = 1. ; double vol2 = 1. ; for ( int i = 0 ; i < dim ; i ++ ) { final double box1min = box1 . getMin ( i ) ; final double box1max = box1 ... | Computes the volume of the overlapping box between two SpatialComparables and return the relation between the volume of the overlapping box and the volume of both SpatialComparable . |
33,564 | public static ModifiableHyperBoundingBox unionTolerant ( SpatialComparable mbr1 , SpatialComparable mbr2 ) { if ( mbr1 == null && mbr2 == null ) { return null ; } if ( mbr1 == null ) { return new ModifiableHyperBoundingBox ( mbr2 ) ; } if ( mbr2 == null ) { return new ModifiableHyperBoundingBox ( mbr1 ) ; } return unio... | Returns the union of the two specified MBRs . Tolerant of null values . |
33,565 | public static double [ ] centroid ( SpatialComparable obj ) { final int dim = obj . getDimensionality ( ) ; double [ ] centroid = new double [ dim ] ; for ( int d = 0 ; d < dim ; d ++ ) { centroid [ d ] = ( obj . getMax ( d ) + obj . getMin ( d ) ) * .5 ; } return centroid ; } | Returns the centroid of this SpatialComparable . |
33,566 | public static LinearScaling fromMinMax ( double min , double max ) { double zoom = 1.0 / ( max - min ) ; return new LinearScaling ( zoom , - min * zoom ) ; } | Make a linear scaling from a given minimum and maximum . The minimum will be mapped to zero the maximum to one . |
33,567 | public double fMeasure ( double beta ) { final double beta2 = beta * beta ; double fmeasure = ( ( 1 + beta2 ) * pairconfuse [ 0 ] ) / ( ( 1 + beta2 ) * pairconfuse [ 0 ] + beta2 * pairconfuse [ 1 ] + pairconfuse [ 2 ] ) ; return fmeasure ; } | Get the pair - counting F - Measure |
33,568 | public void write ( TextWriterStream out , String label , Object object ) { StringBuilder buf = new StringBuilder ( 100 ) ; if ( label != null ) { buf . append ( label ) . append ( '=' ) ; } if ( object != null ) { buf . append ( object . toString ( ) ) ; } out . commentPrintLn ( buf ) ; } | Put an object into the comment section |
33,569 | protected static < I > double [ ] [ ] computeSquaredDistanceMatrix ( final List < I > col , PrimitiveDistanceFunction < ? super I > dist ) { final int size = col . size ( ) ; double [ ] [ ] imat = new double [ size ] [ size ] ; boolean squared = dist . isSquared ( ) ; FiniteProgress dprog = LOG . isVerbose ( ) ? new Fi... | Compute the squared distance matrix . |
33,570 | private OutlierResult getOutlierResult ( ResultHierarchy hier , Result result ) { List < OutlierResult > ors = ResultUtil . filterResults ( hier , result , OutlierResult . class ) ; if ( ! ors . isEmpty ( ) ) { return ors . get ( 0 ) ; } throw new IllegalStateException ( "Comparison algorithm expected at least one outl... | Find an OutlierResult to work with . |
33,571 | protected PolynomialApproximation knnDistanceApproximation ( ) { int p_max = 0 ; double [ ] b = null ; for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { MkAppEntry entry = getEntry ( i ) ; PolynomialApproximation approximation = entry . getKnnDistanceApproximation ( ) ; if ( b == null ) { p_max = approximation . getPo... | Determines and returns the polynomial approximation for the knn distances of this node as the maximum of the polynomial approximations of all entries . |
33,572 | public void setDBIDs ( DBIDs ids ) { this . idrep . setDBIDs ( ids ) ; for ( Relation < ? > orel : this . relations ) { if ( orel instanceof ProxyView ) { ( ( ProxyView < ? > ) orel ) . setDBIDs ( this . idrep . getDBIDs ( ) ) ; } } } | Set the DBIDs to use . |
33,573 | public synchronized Collection < Progress > getProgresses ( ) { List < Progress > list = new ArrayList < > ( progresses . size ( ) ) ; Iterator < WeakReference < Progress > > iter = progresses . iterator ( ) ; while ( iter . hasNext ( ) ) { WeakReference < Progress > ref = iter . next ( ) ; if ( ref . get ( ) == null )... | Get a list of progresses tracked . |
33,574 | public synchronized void addProgress ( Progress p ) { Iterator < WeakReference < Progress > > iter = progresses . iterator ( ) ; while ( iter . hasNext ( ) ) { WeakReference < Progress > ref = iter . next ( ) ; if ( ref . get ( ) == null ) { iter . remove ( ) ; } else { if ( ref . get ( ) == p ) { return ; } } } progre... | Add a new Progress to the tracker . |
33,575 | public synchronized IndexTreePath < DeLiCluEntry > setHandled ( DBID id , O obj ) { if ( LOG . isDebugging ( ) ) { LOG . debugFine ( "setHandled " + id + ", " + obj + "\n" ) ; } IndexTreePath < DeLiCluEntry > pathToObject = findPathToObject ( getRootPath ( ) , obj , id ) ; if ( pathToObject == null ) { throw new AbortE... | Marks the specified object as handled and returns the path of node ids from the root to the objects s parent . |
33,576 | public final boolean delete ( DBIDRef id ) { O obj = relation . get ( id ) ; IndexTreePath < DeLiCluEntry > deletionPath = findPathToObject ( getRootPath ( ) , obj , id ) ; if ( deletionPath == null ) { return false ; } deletePath ( deletionPath ) ; return true ; } | Deletes the specified object from this index . |
33,577 | protected double [ ] makeSample ( int maxk ) { final Random rnd = this . rnd . getSingleThreadedRandom ( ) ; double [ ] dists = new double [ maxk + 1 ] ; final double e = 1. / dim ; for ( int i = 0 ; i <= maxk ; i ++ ) { dists [ i ] = FastMath . pow ( rnd . nextDouble ( ) , e ) ; } Arrays . sort ( dists ) ; return dist... | Generate a data sample . |
33,578 | public final boolean setRoutingObjectID ( DBID objectID ) { if ( objectID == routingObjectID || DBIDUtil . equal ( objectID , routingObjectID ) ) { return false ; } this . routingObjectID = objectID ; return true ; } | Sets the id of the routing object of this entry . |
33,579 | public void writeExternal ( ObjectOutput out ) throws IOException { out . writeInt ( id ) ; out . writeInt ( DBIDUtil . asInteger ( routingObjectID ) ) ; out . writeDouble ( parentDistance ) ; out . writeDouble ( coveringRadius ) ; } | Calls the super method and writes the routingObjectID the parentDistance and the coveringRadius of this entry to the specified stream . |
33,580 | public void write ( TextWriterStream out , String label , TextWriteable obj ) { obj . writeToText ( out , label ) ; } | Use the objects own text serialization . |
33,581 | protected void evaluteResult ( Database db , Clustering < ? > c , Clustering < ? > refc ) { ClusterContingencyTable contmat = new ClusterContingencyTable ( selfPairing , noiseSpecialHandling ) ; contmat . process ( refc , c ) ; ScoreResult sr = new ScoreResult ( contmat ) ; sr . addHeader ( c . getLongName ( ) ) ; db .... | Evaluate a clustering result . |
33,582 | private boolean isReferenceResult ( Clustering < ? > t ) { return "bylabel-clustering" . equals ( t . getShortName ( ) ) || "bymodel-clustering" . equals ( t . getShortName ( ) ) || "allinone-clustering" . equals ( t . getShortName ( ) ) || "allinnoise-clustering" . equals ( t . getShortName ( ) ) ; } | Test if a clustering result is a valid reference result . |
33,583 | public final synchronized int writePage ( P page ) { int pageid = setPageID ( page ) ; writePage ( pageid , page ) ; return pageid ; } | Writes a page into this file . The method tests if the page has already an id otherwise a new id is assigned and returned . |
33,584 | public static Element drawManhattan ( SVGPlot svgp , Projection2D proj , NumberVector mid , double radius ) { final double [ ] v_mid = mid . toArray ( ) ; final long [ ] dims = proj . getVisibleDimensions2D ( ) ; SVGPath path = new SVGPath ( ) ; for ( int dim = BitsUtil . nextSetBit ( dims , 0 ) ; dim >= 0 ; dim = Bits... | Wireframe manhattan hypersphere |
33,585 | public static Element drawCross ( SVGPlot svgp , Projection2D proj , NumberVector mid , double radius ) { final double [ ] v_mid = mid . toArray ( ) ; final long [ ] dims = proj . getVisibleDimensions2D ( ) ; SVGPath path = new SVGPath ( ) ; for ( int dim = BitsUtil . nextSetBit ( dims , 0 ) ; dim >= 0 ; dim = BitsUtil... | Wireframe cross hypersphere |
33,586 | @ SuppressWarnings ( { "cast" , "unchecked" } ) public static < O extends SpatialComparable > RangeQuery < O > getRangeQuery ( AbstractRStarTree < ? , ? , ? > tree , SpatialDistanceQuery < O > distanceQuery , Object ... hints ) { SpatialPrimitiveDistanceFunction < ? super O > df = distanceQuery . getDistanceFunction ( ... | Get an RTree range query using an optimized double implementation when possible . |
33,587 | @ SuppressWarnings ( { "cast" , "unchecked" } ) public static < O extends SpatialComparable > KNNQuery < O > getKNNQuery ( AbstractRStarTree < ? , ? , ? > tree , SpatialDistanceQuery < O > distanceQuery , Object ... hints ) { SpatialPrimitiveDistanceFunction < ? super O > df = distanceQuery . getDistanceFunction ( ) ; ... | Get an RTree knn query using an optimized double implementation when possible . |
33,588 | private void privateReconfigureLogging ( String pkg , final String name ) { LogManager logManager = LogManager . getLogManager ( ) ; Logger logger = Logger . getLogger ( LoggingConfiguration . class . getName ( ) ) ; if ( pkg == null ) { pkg = "" ; } String cfgfile = name ; if ( new File ( name ) . exists ( ) ) { cfgfi... | Reconfigure logging . |
33,589 | private static InputStream openSystemFile ( String filename ) throws FileNotFoundException { try { return new FileInputStream ( filename ) ; } catch ( FileNotFoundException e ) { String resname = File . separatorChar != '/' ? filename . replace ( File . separatorChar , '/' ) : filename ; ClassLoader cl = LoggingConfigu... | Private copy from FileUtil to avoid cross - dependencies . Try to open a file first trying the file system then falling back to the classpath . |
33,590 | public static void setVerbose ( java . util . logging . Level verbose ) { if ( verbose . intValue ( ) <= Level . VERBOSE . intValue ( ) ) { if ( LOGGER_GLOBAL_TOP . getLevel ( ) == null || LOGGER_GLOBAL_TOP . getLevel ( ) . intValue ( ) > verbose . intValue ( ) ) { LOGGER_GLOBAL_TOP . setLevel ( verbose ) ; } if ( LOGG... | Reconfigure logging to enable verbose logging at the top level . |
33,591 | public static void setStatistics ( ) { if ( LOGGER_GLOBAL_TOP . getLevel ( ) == null || LOGGER_GLOBAL_TOP . getLevel ( ) . intValue ( ) > Level . STATISTICS . intValue ( ) ) { LOGGER_GLOBAL_TOP . setLevel ( Level . STATISTICS ) ; } if ( LOGGER_ELKI_TOP . getLevel ( ) == null || LOGGER_ELKI_TOP . getLevel ( ) . intValue... | Enable runtime performance logging . |
33,592 | public static void replaceDefaultHandler ( Handler handler ) { Logger rootlogger = LogManager . getLogManager ( ) . getLogger ( "" ) ; for ( Handler h : rootlogger . getHandlers ( ) ) { if ( h instanceof CLISmartHandler ) { rootlogger . removeHandler ( h ) ; } } addHandler ( handler ) ; } | Replace the default log handler with the given log handler . |
33,593 | public static void setDefaultLevel ( java . util . logging . Level level ) { Logger . getLogger ( TOPLEVEL_PACKAGE ) . setLevel ( level ) ; } | Set the default level . |
33,594 | public static double [ ] getRelativeCoordinates ( Event evt , Element reference ) { if ( evt instanceof DOMMouseEvent && reference instanceof SVGLocatable && reference instanceof SVGElement ) { DOMMouseEvent gnme = ( DOMMouseEvent ) evt ; SVGMatrix mat = ( ( SVGLocatable ) reference ) . getScreenCTM ( ) ; SVGMatrix ima... | Get the relative coordinates of a point within the coordinate system of a particular SVG Element . |
33,595 | public Clustering < MeanModel > run ( Relation < NumberVector > relation ) { final int dim = RelationUtil . dimensionality ( relation ) ; CFTree tree = cffactory . newTree ( relation . getDBIDs ( ) , relation ) ; Map < ClusteringFeature , ModifiableDBIDs > idmap = new HashMap < ClusteringFeature , ModifiableDBIDs > ( t... | Run the clustering algorithm . |
33,596 | public OutlierResult run ( Database database , Relation < O > relation ) { KNNQuery < O > knnq = QueryUtil . getKNNQuery ( relation , getDistanceFunction ( ) , k ) ; WritableDoubleDataStore scores = DataStoreUtil . makeDoubleStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_DB ) ; DoubleMinMax minmax = new Do... | Run the outlier detection algorithm |
33,597 | public static void main ( String [ ] args ) { if ( args . length > 0 && args [ 0 ] . charAt ( 0 ) != '-' ) { Class < ? > cls = ELKIServiceRegistry . findImplementation ( AbstractApplication . class , args [ 0 ] ) ; if ( cls != null ) { try { Method m = cls . getMethod ( "main" , String [ ] . class ) ; Object a = Arrays... | Launch ELKI . |
33,598 | public static Parameterizer getParameterizer ( Class < ? > c ) { for ( Class < ? > inner : c . getDeclaredClasses ( ) ) { if ( Parameterizer . class . isAssignableFrom ( inner ) ) { try { return inner . asSubclass ( Parameterizer . class ) . newInstance ( ) ; } catch ( Exception e ) { LOG . warning ( "Non-usable Parame... | Get a parameterizer for the given class . |
33,599 | private void putRec ( O obj , Rec < O > rec ) { graph . put ( obj , rec ) ; for ( int i = 0 ; i < numelems ; ++ i ) { if ( obj == elems [ i ] ) { return ; } } if ( elems . length == numelems ) { elems = Arrays . copyOf ( elems , ( elems . length << 1 ) + 1 ) ; } elems [ numelems ++ ] = obj ; } | Put a record . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.