idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
33,600
private void removeRec ( O obj ) { graph . remove ( obj ) ; for ( int i = 0 ; i < numelems ; ++ i ) { if ( obj == elems [ i ] ) { System . arraycopy ( elems , i + 1 , elems , i , -- numelems - i ) ; elems [ numelems ] = null ; return ; } } }
Remove a record .
33,601
protected JTree createTree ( ) { JTree tree = new JTree ( model ) ; tree . setName ( "TreePopup.tree" ) ; tree . setFont ( getFont ( ) ) ; tree . setForeground ( getForeground ( ) ) ; tree . setBackground ( getBackground ( ) ) ; tree . setBorder ( null ) ; tree . setFocusable ( true ) ; tree . addMouseListener ( handle...
Creates the JList used in the popup to display the items in the combo box model . This method is called when the UI class is created .
33,602
protected JScrollPane createScroller ( ) { JScrollPane sp = new JScrollPane ( tree , ScrollPaneConstants . VERTICAL_SCROLLBAR_AS_NEEDED , ScrollPaneConstants . HORIZONTAL_SCROLLBAR_NEVER ) ; sp . setHorizontalScrollBar ( null ) ; sp . setName ( "TreePopup.scrollPane" ) ; sp . setFocusable ( false ) ; sp . getVerticalSc...
Creates the scroll pane which houses the scrollable tree .
33,603
public void show ( Component parent ) { Dimension parentSize = parent . getSize ( ) ; Insets insets = getInsets ( ) ; parentSize . setSize ( parentSize . width - ( insets . right + insets . left ) , 10 * parentSize . height ) ; Dimension scrollSize = computePopupBounds ( parent , 0 , getBounds ( ) . height , parentSize...
Display the popup attached to the given component .
33,604
protected void fireActionPerformed ( ActionEvent event ) { Object [ ] listeners = listenerList . getListenerList ( ) ; for ( int i = listeners . length - 2 ; i >= 0 ; i -= 2 ) { if ( listeners [ i ] == ActionListener . class ) { ( ( ActionListener ) listeners [ i + 1 ] ) . actionPerformed ( event ) ; } } }
Notify action listeners .
33,605
private < T > void setCached ( String prefix , String postfix , T data ) { cache . put ( prefix + '.' + postfix , data ) ; }
Set a cache value
33,606
protected String getPropertyValue ( String prefix , String postfix ) { String ret = properties . getProperty ( prefix + "." + postfix ) ; if ( ret != null ) { return ret ; } int pos = prefix . length ( ) ; while ( pos > 0 ) { pos = prefix . lastIndexOf ( '.' , pos - 1 ) ; if ( pos <= 0 ) { break ; } ret = properties . ...
Retrieve the property value for a particular path + type pair .
33,607
@ SuppressWarnings ( "unchecked" ) public static < V extends NumberVector > NumberVector . Factory < V > guessFactory ( SimpleTypeInformation < V > in ) { NumberVector . Factory < V > factory = null ; if ( in instanceof VectorTypeInformation ) { factory = ( NumberVector . Factory < V > ) ( ( VectorTypeInformation < V >...
Try to guess the appropriate factory .
33,608
public void appendSimple ( Object ... data ) { if ( data . length != meta . size ( ) ) { throw new AbortException ( "Invalid number of attributes in 'append'." ) ; } for ( int i = 0 ; i < data . length ; i ++ ) { @ SuppressWarnings ( "unchecked" ) final List < Object > col = ( List < Object > ) columns . get ( i ) ; co...
Append a new record to the data set . Pay attention to having the right number of values!
33,609
public static MultipleObjectsBundle fromStream ( BundleStreamSource source ) { MultipleObjectsBundle bundle = new MultipleObjectsBundle ( ) ; boolean stop = false ; DBIDVar var = null ; ArrayModifiableDBIDs ids = null ; int size = 0 ; while ( ! stop ) { BundleStreamSource . Event ev = source . nextEvent ( ) ; switch ( ...
Convert an object stream to a bundle
33,610
public Object [ ] getRow ( int row ) { Object [ ] ret = new Object [ columns . size ( ) ] ; for ( int c = 0 ; c < columns . size ( ) ; c ++ ) { ret [ c ] = data ( row , c ) ; } return ret ; }
Get an object row .
33,611
protected void batchNN ( AbstractRStarTreeNode < ? , ? > node , Map < DBID , KNNHeap > knnLists ) { if ( node . isLeaf ( ) ) { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { SpatialEntry p = node . getEntry ( i ) ; for ( Entry < DBID , KNNHeap > ent : knnLists . entrySet ( ) ) { final DBID q = ent . getKey (...
Performs a batch knn query .
33,612
protected List < DoubleDistanceEntry > getSortedEntries ( AbstractRStarTreeNode < ? , ? > node , DBIDs ids ) { List < DoubleDistanceEntry > result = new ArrayList < > ( ) ; for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { SpatialEntry entry = node . getEntry ( i ) ; double minMinDist = Double . MAX_VALUE ; for...
Sorts the entries of the specified node according to their minimum distance to the specified objects .
33,613
private boolean checkCandidateUpdate ( double [ ] point ) { final double x = point [ 0 ] , y = point [ 1 ] ; if ( points . isEmpty ( ) ) { leftx = rightx = x ; topy = bottomy = y ; topleft = topright = bottomleft = bottomright = point ; return true ; } if ( x <= leftx || x >= rightx || y <= bottomy || y >= topy ) { dou...
Check whether a point is inside the current bounds and update the bounds
33,614
static DBIDs randomSample ( DBIDs ids , int samplesize , Random rnd , DBIDs previous ) { if ( previous == null ) { return DBIDUtil . randomSample ( ids , samplesize , rnd ) ; } ModifiableDBIDs sample = DBIDUtil . newHashSet ( samplesize ) ; sample . addDBIDs ( previous ) ; sample . addDBIDs ( DBIDUtil . randomSample ( ...
Draw a random sample of the desired size .
33,615
public void actionPerformed ( ActionEvent e ) { final JFileChooser fc = new JFileChooser ( new File ( "." ) ) ; if ( param . isDefined ( ) ) { fc . setSelectedFile ( param . getValue ( ) ) ; } if ( e . getSource ( ) == button ) { int returnVal = fc . showOpenDialog ( button ) ; if ( returnVal == JFileChooser . APPROVE_...
Button callback to show the file selector
33,616
protected Node inlineThumbnail ( Document doc , ParsedURL urldata , Node eold ) { RenderableImage img = ThumbnailRegistryEntry . handleURL ( urldata ) ; if ( img == null ) { LoggingUtil . warning ( "Image not found in registry: " + urldata . toString ( ) ) ; return null ; } ByteArrayOutputStream os = new ByteArrayOutpu...
Inline a referenced thumbnail .
33,617
private static PrintStream openStream ( File out ) throws IOException { OutputStream os = new FileOutputStream ( out ) ; os = out . getName ( ) . endsWith ( GZIP_POSTFIX ) ? new GZIPOutputStream ( os ) : os ; return new PrintStream ( os ) ; }
Open the output stream using gzip if necessary .
33,618
public void setDimensionality ( int dimensionality ) throws IllegalArgumentException { final int maxdim = getMaxDim ( ) ; if ( maxdim > dimensionality ) { throw new IllegalArgumentException ( "Given dimensionality " + dimensionality + " is too small w.r.t. the given values (occurring maximum: " + maxdim + ")." ) ; } th...
Sets the dimensionality to the new value .
33,619
protected IndexTreePath < E > findPathToObject ( IndexTreePath < E > subtree , SpatialComparable mbr , DBIDRef id ) { N node = getNode ( subtree . getEntry ( ) ) ; if ( node . isLeaf ( ) ) { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { if ( DBIDUtil . equal ( ( ( LeafEntry ) node . getEntry ( i ) ) . getDB...
Returns the path to the leaf entry in the specified subtree that represents the data object with the specified mbr and id .
33,620
protected void deletePath ( IndexTreePath < E > deletionPath ) { N leaf = getNode ( deletionPath . getParentPath ( ) . getEntry ( ) ) ; int index = deletionPath . getIndex ( ) ; E entry = leaf . getEntry ( index ) ; leaf . deleteEntry ( index ) ; writeNode ( leaf ) ; Stack < N > stack = new Stack < > ( ) ; condenseTree...
Delete a leaf at a given path - deletions for non - leaves are not supported!
33,621
protected List < E > createBulkLeafNodes ( List < E > objects ) { int minEntries = leafMinimum ; int maxEntries = leafCapacity ; ArrayList < E > result = new ArrayList < > ( ) ; List < List < E > > partitions = settings . bulkSplitter . partition ( objects , minEntries , maxEntries ) ; for ( List < E > partition : part...
Creates and returns the leaf nodes for bulk load .
33,622
protected IndexTreePath < E > choosePath ( IndexTreePath < E > subtree , SpatialComparable mbr , int depth , int cur ) { if ( getLogger ( ) . isDebuggingFiner ( ) ) { getLogger ( ) . debugFiner ( "node " + subtree + ", depth " + depth ) ; } N node = getNode ( subtree . getEntry ( ) ) ; if ( node == null ) { throw new R...
Chooses the best path of the specified subtree for insertion of the given mbr at the specified level .
33,623
private N split ( N node ) { int minimum = node . isLeaf ( ) ? leafMinimum : dirMinimum ; long [ ] split = settings . nodeSplitter . split ( node , NodeArrayAdapter . STATIC , minimum ) ; final N newNode = node . isLeaf ( ) ? createNewLeafNode ( ) : createNewDirectoryNode ( ) ; node . splitByMask ( newNode , split ) ; ...
Splits the specified node and returns the newly created split node .
33,624
public void reInsert ( N node , IndexTreePath < E > path , int [ ] offs ) { final int depth = path . getPathCount ( ) ; long [ ] remove = BitsUtil . zero ( node . getCapacity ( ) ) ; List < E > reInsertEntries = new ArrayList < > ( offs . length ) ; for ( int i = 0 ; i < offs . length ; i ++ ) { reInsertEntries . add (...
Reinserts the specified node at the specified level .
33,625
private void condenseTree ( IndexTreePath < E > subtree , Stack < N > stack ) { N node = getNode ( subtree . getEntry ( ) ) ; if ( ! isRoot ( node ) ) { N parent = getNode ( subtree . getParentPath ( ) . getEntry ( ) ) ; int index = subtree . getIndex ( ) ; if ( hasUnderflow ( node ) ) { if ( parent . deleteEntry ( ind...
Condenses the tree after deletion of some nodes .
33,626
private void getLeafNodes ( N node , List < E > result , int currentLevel ) { if ( currentLevel == 2 ) { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { result . add ( node . getEntry ( i ) ) ; } } else { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { getLeafNodes ( getNode ( node . getEntry ( i ) ...
Determines the entries pointing to the leaf nodes of the specified subtree .
33,627
public static double angleDense ( NumberVector v1 , NumberVector v2 ) { final int dim1 = v1 . getDimensionality ( ) , dim2 = v2 . getDimensionality ( ) ; final int mindim = ( dim1 <= dim2 ) ? dim1 : dim2 ; double cross = 0 , l1 = 0 , l2 = 0 ; for ( int k = 0 ; k < mindim ; k ++ ) { final double r1 = v1 . doubleValue ( ...
Compute the absolute cosine of the angle between two dense vectors .
33,628
public static double angleSparse ( SparseNumberVector v1 , SparseNumberVector v2 ) { double l1 = 0. , l2 = 0. , cross = 0. ; int i1 = v1 . iter ( ) , i2 = v2 . iter ( ) ; while ( v1 . iterValid ( i1 ) && v2 . iterValid ( i2 ) ) { final int d1 = v1 . iterDim ( i1 ) , d2 = v2 . iterDim ( i2 ) ; if ( d1 < d2 ) { final dou...
Compute the angle for sparse vectors .
33,629
public static double angleSparseDense ( SparseNumberVector v1 , NumberVector v2 ) { final int dim2 = v2 . getDimensionality ( ) ; double l1 = 0. , l2 = 0. , cross = 0. ; int i1 = v1 . iter ( ) , d2 = 0 ; while ( v1 . iterValid ( i1 ) ) { final int d1 = v1 . iterDim ( i1 ) ; while ( d2 < d1 && d2 < dim2 ) { final double...
Compute the angle for a sparse and a dense vector .
33,630
public static double cosAngle ( NumberVector v1 , NumberVector v2 ) { return v1 instanceof SparseNumberVector ? v2 instanceof SparseNumberVector ? angleSparse ( ( SparseNumberVector ) v1 , ( SparseNumberVector ) v2 ) : angleSparseDense ( ( SparseNumberVector ) v1 , v2 ) : v2 instanceof SparseNumberVector ? angleSparseD...
Compute the absolute cosine of the angle between two vectors .
33,631
public static double minCosAngle ( SpatialComparable v1 , SpatialComparable v2 ) { if ( v1 instanceof NumberVector && v2 instanceof NumberVector ) { return cosAngle ( ( NumberVector ) v1 , ( NumberVector ) v2 ) ; } final int dim1 = v1 . getDimensionality ( ) , dim2 = v2 . getDimensionality ( ) ; final int mindim = ( di...
Compute the minimum angle between two rectangles .
33,632
public static double angle ( NumberVector v1 , NumberVector v2 , NumberVector o ) { final int dim1 = v1 . getDimensionality ( ) , dim2 = v2 . getDimensionality ( ) , dimo = o . getDimensionality ( ) ; final int mindim = ( dim1 <= dim2 ) ? dim1 : dim2 ; double cross = 0 , l1 = 0 , l2 = 0 ; for ( int k = 0 ; k < mindim ;...
Compute the angle between two vectors with respect to a reference point .
33,633
public static double dotDense ( NumberVector v1 , NumberVector v2 ) { final int dim1 = v1 . getDimensionality ( ) , dim2 = v2 . getDimensionality ( ) ; final int mindim = ( dim1 <= dim2 ) ? dim1 : dim2 ; double dot = 0 ; for ( int k = 0 ; k < mindim ; k ++ ) { dot += v1 . doubleValue ( k ) * v2 . doubleValue ( k ) ; } ...
Compute the dot product of two dense vectors .
33,634
public static double dotSparse ( SparseNumberVector v1 , SparseNumberVector v2 ) { double dot = 0. ; int i1 = v1 . iter ( ) , i2 = v2 . iter ( ) ; while ( v1 . iterValid ( i1 ) && v2 . iterValid ( i2 ) ) { final int d1 = v1 . iterDim ( i1 ) , d2 = v2 . iterDim ( i2 ) ; if ( d1 < d2 ) { i1 = v1 . iterAdvance ( i1 ) ; } ...
Compute the dot product for two sparse vectors .
33,635
public static double dotSparseDense ( SparseNumberVector v1 , NumberVector v2 ) { final int dim2 = v2 . getDimensionality ( ) ; double dot = 0. ; for ( int i1 = v1 . iter ( ) ; v1 . iterValid ( i1 ) ; ) { final int d1 = v1 . iterDim ( i1 ) ; if ( d1 >= dim2 ) { break ; } dot += v1 . iterDoubleValue ( i1 ) * v2 . double...
Compute the dot product for a sparse and a dense vector .
33,636
public static double dot ( NumberVector v1 , NumberVector v2 ) { return v1 instanceof SparseNumberVector ? v2 instanceof SparseNumberVector ? dotSparse ( ( SparseNumberVector ) v1 , ( SparseNumberVector ) v2 ) : dotSparseDense ( ( SparseNumberVector ) v1 , v2 ) : v2 instanceof SparseNumberVector ? dotSparseDense ( ( Sp...
Compute the dot product of the angle between two vectors .
33,637
public static double minDot ( SpatialComparable v1 , SpatialComparable v2 ) { if ( v1 instanceof NumberVector && v2 instanceof NumberVector ) { return dot ( ( NumberVector ) v1 , ( NumberVector ) v2 ) ; } final int dim1 = v1 . getDimensionality ( ) , dim2 = v2 . getDimensionality ( ) ; final int mindim = ( dim1 <= dim2...
Compute the minimum angle between two rectangles assuming unit length vectors
33,638
public static < V extends NumberVector > V project ( V v , long [ ] selectedAttributes , NumberVector . Factory < V > factory ) { int card = BitsUtil . cardinality ( selectedAttributes ) ; if ( factory instanceof SparseNumberVector . Factory ) { final SparseNumberVector . Factory < ? > sfactory = ( SparseNumberVector ....
Project a number vector to the specified attributes .
33,639
public void mergeWith ( Core o ) { o . num = this . num = ( num < o . num ? num : o . num ) ; }
Merge two cores .
33,640
public Clustering < Model > run ( Relation < ? > relation ) { HashMap < String , DBIDs > labelMap = multiple ? multipleAssignment ( relation ) : singleAssignment ( relation ) ; ModifiableDBIDs noiseids = DBIDUtil . newArray ( ) ; Clustering < Model > result = new Clustering < > ( "By Label Clustering" , "bylabel-cluste...
Run the actual clustering algorithm .
33,641
private HashMap < String , DBIDs > singleAssignment ( Relation < ? > data ) { HashMap < String , DBIDs > labelMap = new HashMap < > ( ) ; for ( DBIDIter iditer = data . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { final Object val = data . get ( iditer ) ; String label = ( val != null ) ? val . toStrin...
Assigns the objects of the database to single clusters according to their labels .
33,642
private HashMap < String , DBIDs > multipleAssignment ( Relation < ? > data ) { HashMap < String , DBIDs > labelMap = new HashMap < > ( ) ; for ( DBIDIter iditer = data . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { String [ ] labels = data . get ( iditer ) . toString ( ) . split ( " " ) ; for ( String...
Assigns the objects of the database to multiple clusters according to their labels .
33,643
private void assign ( HashMap < String , DBIDs > labelMap , String label , DBIDRef id ) { if ( labelMap . containsKey ( label ) ) { DBIDs exist = labelMap . get ( label ) ; if ( exist instanceof DBID ) { ModifiableDBIDs n = DBIDUtil . newHashSet ( ) ; n . add ( ( DBID ) exist ) ; n . add ( id ) ; labelMap . put ( label...
Assigns the specified id to the labelMap according to its label
33,644
public void put ( double val ) { min = val < min ? val : min ; max = val > max ? val : max ; }
Process a single double value .
33,645
public static void addShadowFilter ( SVGPlot svgp ) { Element shadow = svgp . getIdElement ( SHADOW_ID ) ; if ( shadow == null ) { shadow = svgp . svgElement ( SVGConstants . SVG_FILTER_TAG ) ; shadow . setAttribute ( SVGConstants . SVG_ID_ATTRIBUTE , SHADOW_ID ) ; shadow . setAttribute ( SVGConstants . SVG_WIDTH_ATTRI...
Static method to prepare a SVG document for drop shadow effects .
33,646
public static void addLightGradient ( SVGPlot svgp ) { Element gradient = svgp . getIdElement ( LIGHT_GRADIENT_ID ) ; if ( gradient == null ) { gradient = svgp . svgElement ( SVGConstants . SVG_LINEAR_GRADIENT_TAG ) ; gradient . setAttribute ( SVGConstants . SVG_ID_ATTRIBUTE , LIGHT_GRADIENT_ID ) ; gradient . setAttrib...
Static method to prepare a SVG document for light gradient effects .
33,647
public static Element makeCheckmark ( SVGPlot svgp ) { Element checkmark = svgp . svgElement ( SVGConstants . SVG_PATH_TAG ) ; checkmark . setAttribute ( SVGConstants . SVG_D_ATTRIBUTE , SVG_CHECKMARK_PATH ) ; checkmark . setAttribute ( SVGConstants . SVG_FILL_ATTRIBUTE , SVGConstants . CSS_BLACK_VALUE ) ; checkmark . ...
Creates a 15x15 big checkmark
33,648
public double continueToMargin ( double [ ] origin , double [ ] delta ) { assert ( delta . length == 2 && origin . length == 2 ) ; double factor = Double . POSITIVE_INFINITY ; if ( delta [ 0 ] > 0 ) { factor = Math . min ( factor , ( maxx - origin [ 0 ] ) / delta [ 0 ] ) ; } else if ( delta [ 0 ] < 0 ) { factor = Math ...
Continue a line along a given direction to the margin .
33,649
public void clear ( ) { try { file . setLength ( header . size ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
Clears this PageFile .
33,650
private double deviation ( double [ ] delta , double [ ] [ ] beta ) { final double a = squareSum ( delta ) ; final double b = squareSum ( transposeTimes ( beta , delta ) ) ; return ( a > b ) ? FastMath . sqrt ( a - b ) : 0. ; }
Deviation from a manifold described by beta .
33,651
private Separation findSeparation ( Relation < NumberVector > relation , DBIDs currentids , int dimension , Random r ) { Separation separation = new Separation ( ) ; int samples = ( int ) Math . min ( LOG_NOT_FROM_ONE_CLUSTER_PROBABILITY / ( FastMath . log1p ( - FastMath . powFast ( samplingLevel , - dimension ) ) ) , ...
This method samples a number of linear manifolds an tries to determine which the one with the best cluster is .
33,652
public double getDistance ( final DBIDRef o1 , final DBIDRef o2 ) { return FastMath . sqrt ( getSquaredDistance ( o1 , o2 ) ) ; }
Returns the kernel distance between the two specified objects .
33,653
public double getSquaredDistance ( final DBIDRef id1 , final DBIDRef id2 ) { final int o1 = idmap . getOffset ( id1 ) , o2 = idmap . getOffset ( id2 ) ; return kernel [ o1 ] [ o1 ] + kernel [ o2 ] [ o2 ] - 2 * kernel [ o1 ] [ o2 ] ; }
Returns the squared kernel distance between the two specified objects .
33,654
public double getSimilarity ( DBIDRef id1 , DBIDRef id2 ) { return kernel [ idmap . getOffset ( id1 ) ] [ idmap . getOffset ( id2 ) ] ; }
Get the kernel similarity for the given objects .
33,655
protected double [ ] [ ] initialMeans ( Database database , Relation < V > relation ) { Duration inittime = getLogger ( ) . newDuration ( initializer . getClass ( ) + ".time" ) . begin ( ) ; double [ ] [ ] means = initializer . chooseInitialMeans ( database , relation , k , getDistanceFunction ( ) ) ; getLogger ( ) . s...
Choose the initial means .
33,656
public static void plusEquals ( double [ ] sum , NumberVector vec ) { for ( int d = 0 ; d < sum . length ; d ++ ) { sum [ d ] += vec . doubleValue ( d ) ; } }
Similar to VMath . plusEquals but accepts a number vector .
33,657
public static void minusEquals ( double [ ] sum , NumberVector vec ) { for ( int d = 0 ; d < sum . length ; d ++ ) { sum [ d ] -= vec . doubleValue ( d ) ; } }
Similar to VMath . minusEquals but accepts a number vector .
33,658
public static void plusMinusEquals ( double [ ] add , double [ ] sub , NumberVector vec ) { for ( int d = 0 ; d < add . length ; d ++ ) { final double v = vec . doubleValue ( d ) ; add [ d ] += v ; sub [ d ] -= v ; } }
Add to one remove from another .
33,659
protected static void incrementalUpdateMean ( double [ ] mean , NumberVector vec , int newsize , double op ) { if ( newsize == 0 ) { return ; } VMath . plusTimesEquals ( mean , VMath . minusEquals ( vec . toArray ( ) , mean ) , op / newsize ) ; }
Compute an incremental update for the mean .
33,660
public static int fastModPrime ( long data ) { int high = ( int ) ( data >>> 32 ) ; int alpha = ( ( int ) data ) + ( high << 2 + high ) ; if ( alpha < 0 && alpha > - 5 ) { alpha = alpha + 5 ; } return alpha ; }
Fast modulo operation for the largest unsigned integer prime .
33,661
private void doRangeQuery ( DBID o_p , AbstractMTreeNode < O , ? , ? > node , O q , double r_q , ModifiableDoubleDBIDList result ) { double d1 = 0. ; if ( o_p != null ) { d1 = distanceQuery . distance ( o_p , q ) ; index . statistics . countDistanceCalculation ( ) ; } if ( ! node . isLeaf ( ) ) { for ( int i = 0 ; i < ...
Performs a range query on the specified subtree . It recursively traverses all paths from the specified node which cannot be excluded from leading to qualifying objects .
33,662
public static double pdf ( double x , double mu , double beta ) { final double z = ( x - mu ) / beta ; if ( x == Double . NEGATIVE_INFINITY ) { return 0. ; } return FastMath . exp ( - z - FastMath . exp ( - z ) ) / beta ; }
PDF of Gumbel distribution
33,663
public static double logpdf ( double x , double mu , double beta ) { if ( x == Double . NEGATIVE_INFINITY ) { return Double . NEGATIVE_INFINITY ; } final double z = ( x - mu ) / beta ; return - z - FastMath . exp ( - z ) - FastMath . log ( beta ) ; }
log PDF of Gumbel distribution
33,664
public static double cdf ( double val , double mu , double beta ) { return FastMath . exp ( - FastMath . exp ( - ( val - mu ) / beta ) ) ; }
CDF of Gumbel distribution
33,665
public static double quantile ( double val , double mu , double beta ) { return mu - beta * FastMath . log ( - FastMath . log ( val ) ) ; }
Quantile function of Gumbel distribution
33,666
public void setPartitions ( Relation < V > relation ) throws IllegalArgumentException { if ( ( FastMath . log ( partitions ) / FastMath . log ( 2 ) ) != ( int ) ( FastMath . log ( partitions ) / FastMath . log ( 2 ) ) ) { throw new IllegalArgumentException ( "Number of partitions must be a power of 2!" ) ; } final int ...
Initialize the data set grid by computing quantiles .
33,667
public long getScannedPages ( ) { int vacapacity = pageSize / VectorApproximation . byteOnDisk ( splitPositions . length , partitions ) ; long vasize = ( long ) Math . ceil ( ( vectorApprox . size ( ) ) / ( 1.0 * vacapacity ) ) ; return vasize * scans ; }
Get the number of scanned bytes .
33,668
private void hqr2BackTransformation ( int nn , int low , int high ) { for ( int j = nn - 1 ; j >= low ; j -- ) { final int last = j < high ? j : high ; for ( int i = low ; i <= high ; i ++ ) { final double [ ] Vi = V [ i ] ; double sum = 0. ; for ( int k = low ; k <= last ; k ++ ) { sum += Vi [ k ] * H [ k ] [ j ] ; } ...
Back transformation to get eigenvectors of original matrix .
33,669
protected static double gammaQuantileNewtonRefinement ( final double logpt , final double k , final double theta , final int maxit , double x ) { final double EPS_N = 1e-15 ; if ( x <= 0 ) { x = Double . MIN_NORMAL ; } double logpc = logcdf ( x , k , theta ) ; if ( x == Double . MIN_NORMAL && logpc > logpt * ( 1. + 1e-...
Refinement of ChiSquared probit using Newton iterations .
33,670
public Element useMarker ( SVGPlot plot , Element parent , double x , double y , int stylenr , double size ) { Element marker = plot . svgCircle ( x , y , size * .5 ) ; final String col ; if ( stylenr == - 1 ) { col = dotcolor ; } else if ( stylenr == - 2 ) { col = greycolor ; } else { col = colors . getColor ( stylenr...
Use a given marker on the document .
33,671
public Clustering < DendrogramModel > run ( PointerHierarchyRepresentationResult pointerresult ) { Clustering < DendrogramModel > result = new Instance ( pointerresult ) . run ( ) ; result . addChildResult ( pointerresult ) ; return result ; }
Process an existing result .
33,672
public static double erf ( double x ) { final double w = x < 0 ? - x : x ; double y ; if ( w < 2.2 ) { double t = w * w ; int k = ( int ) t ; t -= k ; k *= 13 ; y = ( ( ( ( ( ( ( ( ( ( ( ( ERF_COEFF1 [ k ] * t + ERF_COEFF1 [ k + 1 ] ) * t + ERF_COEFF1 [ k + 2 ] ) * t + ERF_COEFF1 [ k + 3 ] ) * t + ERF_COEFF1 [ k + 4 ] ...
Error function for Gaussian distributions = Normal distributions .
33,673
public static double standardNormalQuantile ( double d ) { return ( d == 0 ) ? Double . NEGATIVE_INFINITY : ( d == 1 ) ? Double . POSITIVE_INFINITY : ( Double . isNaN ( d ) || d < 0 || d > 1 ) ? Double . NaN : MathUtil . SQRT2 * - erfcinv ( 2 * d ) ; }
Approximate the inverse error function for normal distributions .
33,674
public < N extends SpatialComparable > List < List < N > > partition ( List < N > spatialObjects , int minEntries , int maxEntries ) { List < List < N > > partitions = new ArrayList < > ( ) ; List < N > objects = new ArrayList < > ( spatialObjects ) ; while ( ! objects . isEmpty ( ) ) { StringBuilder msg = new StringBu...
Partitions the specified feature vectors where the split axes are the dimensions with maximum extension .
33,675
private int chooseMaximalExtendedSplitAxis ( List < ? extends SpatialComparable > objects ) { int dimension = objects . get ( 0 ) . getDimensionality ( ) ; double [ ] maxExtension = new double [ dimension ] ; double [ ] minExtension = new double [ dimension ] ; Arrays . fill ( minExtension , Double . MAX_VALUE ) ; for ...
Computes and returns the best split axis . The best split axis is the split axes with the maximal extension .
33,676
public void setTotal ( int total ) throws IllegalArgumentException { if ( getProcessed ( ) > total ) { throw new IllegalArgumentException ( getProcessed ( ) + " exceeds total: " + total ) ; } this . total = total ; }
Modify the total value .
33,677
@ SuppressWarnings ( "unchecked" ) protected < T > T get ( DBIDRef id , int index ) { Object [ ] d = data . get ( DBIDUtil . deref ( id ) ) ; if ( d == null ) { return null ; } return ( T ) d [ index ] ; }
Actual getter .
33,678
@ SuppressWarnings ( "unchecked" ) protected < T > T set ( DBIDRef id , int index , T value ) { Object [ ] d = data . get ( DBIDUtil . deref ( id ) ) ; if ( d == null ) { d = new Object [ rlen ] ; data . put ( DBIDUtil . deref ( id ) , d ) ; } T ret = ( T ) d [ index ] ; d [ index ] = value ; return ret ; }
Actual setter .
33,679
public UniformDistribution estimate ( DoubleMinMax mm ) { return new UniformDistribution ( Math . max ( mm . getMin ( ) , - Double . MAX_VALUE ) , Math . min ( mm . getMax ( ) , Double . MAX_VALUE ) ) ; }
Estimate parameters from minimum and maximum observed .
33,680
public static boolean canVisualize ( Relation < ? > rel , AbstractMTree < ? , ? , ? , ? > tree ) { if ( ! TypeUtil . NUMBER_VECTOR_FIELD . isAssignableFromType ( rel . getDataTypeInformation ( ) ) ) { return false ; } return getLPNormP ( tree ) > 0 ; }
Test for a visualizable index in the context s database .
33,681
void initializeRandomAttributes ( SimpleTypeInformation < V > in ) { int d = ( ( VectorFieldTypeInformation < V > ) in ) . getDimensionality ( ) ; selectedAttributes = BitsUtil . random ( k , d , rnd . getSingleThreadedRandom ( ) ) ; }
Initialize random attributes .
33,682
protected void singleEnsemble ( final double [ ] ensemble , final NumberVector vec ) { double [ ] buf = new double [ 1 ] ; for ( int i = 0 ; i < ensemble . length ; i ++ ) { buf [ 0 ] = vec . doubleValue ( i ) ; ensemble [ i ] = voting . combine ( buf , 1 ) ; if ( Double . isNaN ( ensemble [ i ] ) ) { LOG . warning ( "...
Build a single - element ensemble .
33,683
public static String getFullDescription ( Parameter < ? > param ) { StringBuilder description = new StringBuilder ( 1000 ) . append ( param . getShortDescription ( ) ) . append ( FormatUtil . NEWLINE ) ; param . describeValues ( description ) ; if ( ! FormatUtil . endsWith ( description , FormatUtil . NEWLINE ) ) { des...
Format a parameter description .
33,684
private static void println ( StringBuilder buf , int width , String data ) { for ( String line : FormatUtil . splitAtLastBlank ( data , width ) ) { buf . append ( line ) ; if ( ! line . endsWith ( FormatUtil . NEWLINE ) ) { buf . append ( FormatUtil . NEWLINE ) ; } } }
Simple writing helper with no indentation .
33,685
public static int centroids ( Relation < ? extends NumberVector > rel , List < ? extends Cluster < ? > > clusters , NumberVector [ ] centroids , NoiseHandling noiseOption ) { assert ( centroids . length == clusters . size ( ) ) ; int ignorednoise = 0 ; Iterator < ? extends Cluster < ? > > ci = clusters . iterator ( ) ;...
Compute centroids .
33,686
public static double cdf ( double val , double rate ) { final double v = .5 * FastMath . exp ( - rate * Math . abs ( val ) ) ; return ( v == Double . POSITIVE_INFINITY ) ? ( ( val <= 0 ) ? 0 : 1 ) : ( val < 0 ) ? v : 1 - v ; }
Cumulative density static version
33,687
protected double maxDistance ( DoubleDBIDList elems ) { double max = 0 ; for ( DoubleDBIDListIter it = elems . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { final double v = it . doubleValue ( ) ; max = max > v ? max : v ; } return max ; }
Find maximum in a list via scanning .
33,688
protected void excludeNotCovered ( ModifiableDoubleDBIDList candidates , double fmax , ModifiableDoubleDBIDList collect ) { for ( DoubleDBIDListIter it = candidates . iter ( ) ; it . valid ( ) ; ) { if ( it . doubleValue ( ) > fmax ) { collect . add ( it . doubleValue ( ) , it ) ; candidates . removeSwap ( it . getOffs...
Retain all elements within the current cover .
33,689
protected void collectByCover ( DBIDRef cur , ModifiableDoubleDBIDList candidates , double fmax , ModifiableDoubleDBIDList collect ) { assert ( collect . size ( ) == 0 ) : "Not empty" ; DoubleDBIDListIter it = candidates . iter ( ) . advance ( ) ; while ( it . valid ( ) ) { assert ( ! DBIDUtil . equal ( cur , it ) ) ; ...
Collect all elements with respect to a new routing object .
33,690
private void process ( double [ ] data , double min , double max , KernelDensityFunction kernel , int window , double epsilon ) { dens = new double [ data . length ] ; var = new double [ data . length ] ; double halfwidth = ( ( max - min ) / window ) * .5 ; for ( int current = 0 ; current < data . length ; current ++ )...
Process a new array
33,691
public static double [ ] computeSimilarityMatrix ( DependenceMeasure sim , Relation < ? extends NumberVector > rel ) { final int dim = RelationUtil . dimensionality ( rel ) ; double [ ] [ ] data = new double [ dim ] [ rel . size ( ) ] ; int r = 0 ; for ( DBIDIter it = rel . iterDBIDs ( ) ; it . valid ( ) ; it . advance...
Compute a column - wise dependency matrix for the given relation .
33,692
protected N buildSpanningTree ( int dim , double [ ] mat , Layout layout ) { assert ( layout . edges == null || layout . edges . size ( ) == 0 ) ; int [ ] iedges = PrimsMinimumSpanningTree . processDense ( mat , new LowerTriangularAdapter ( dim ) ) ; int root = findOptimalRoot ( iedges ) ; ArrayList < Edge > edges = ne...
Build the minimum spanning tree .
33,693
protected N buildTree ( int [ ] msg , int cur , int parent , ArrayList < N > nodes ) { int c = 0 ; for ( int i = 1 ; i < msg . length ; i += 2 ) { if ( ( msg [ i - 1 ] == cur && msg [ i ] != parent ) || ( msg [ i ] == cur && msg [ i - 1 ] != parent ) ) { c ++ ; } } List < N > children = Collections . emptyList ( ) ; if...
Recursive tree build method .
33,694
protected int maxDepth ( Layout . Node node ) { int depth = 0 ; for ( int i = 0 ; i < node . numChildren ( ) ; i ++ ) { depth = Math . max ( depth , maxDepth ( node . getChild ( i ) ) ) ; } return depth + 1 ; }
Compute the depth of the graph .
33,695
public void initialize ( ) { TreeIndexHeader header = createHeader ( ) ; if ( this . file . initialize ( header ) ) { initializeFromFile ( header , file ) ; } rootEntry = createRootEntry ( ) ; }
Initialize the tree if the page file already existed .
33,696
public N getNode ( int nodeID ) { if ( nodeID == getPageID ( rootEntry ) ) { return getRoot ( ) ; } else { return file . readPage ( nodeID ) ; } }
Returns the node with the specified id .
33,697
public void initializeFromFile ( TreeIndexHeader header , PageFile < N > file ) { this . dirCapacity = header . getDirCapacity ( ) ; this . leafCapacity = header . getLeafCapacity ( ) ; this . dirMinimum = header . getDirMinimum ( ) ; this . leafMinimum = header . getLeafMinimum ( ) ; if ( getLogger ( ) . isDebugging (...
Initializes this index from an existing persistent file .
33,698
protected final void initialize ( E exampleLeaf ) { initializeCapacities ( exampleLeaf ) ; createEmptyRoot ( exampleLeaf ) ; final Logging log = getLogger ( ) ; if ( log . isStatistics ( ) ) { String cls = this . getClass ( ) . getName ( ) ; log . statistics ( new LongStatistic ( cls + ".directory.capacity" , dirCapaci...
Initializes the index .
33,699
public static MeanVarianceMinMax [ ] newArray ( int dimensionality ) { MeanVarianceMinMax [ ] arr = new MeanVarianceMinMax [ dimensionality ] ; for ( int i = 0 ; i < dimensionality ; i ++ ) { arr [ i ] = new MeanVarianceMinMax ( ) ; } return arr ; }
Create and initialize a new array of MeanVarianceMinMax