idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
157,300 | 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 . |
157,301 | 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 . |
157,302 | 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 . |
157,303 | 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 |
157,304 | 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 . |
157,305 | 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 |
157,306 | 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 . |
157,307 | 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 . |
157,308 | 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 . |
157,309 | 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 . |
157,310 | 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! |
157,311 | 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 . |
157,312 | 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 . |
157,313 | 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 . |
157,314 | 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 . |
157,315 | 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 . |
157,316 | 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 . |
157,317 | 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 . |
157,318 | 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 . |
157,319 | 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 . |
157,320 | 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 . |
157,321 | 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 . |
157,322 | 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 . |
157,323 | 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 . |
157,324 | 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 . |
157,325 | 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 . |
157,326 | 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 . |
157,327 | 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 |
157,328 | 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 . |
157,329 | public void mergeWith ( Core o ) { o . num = this . num = ( num < o . num ? num : o . num ) ; } | Merge two cores . |
157,330 | 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 . |
157,331 | 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 . |
157,332 | 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 . |
157,333 | 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 |
157,334 | public void put ( double val ) { min = val < min ? val : min ; max = val > max ? val : max ; } | Process a single double value . |
157,335 | 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 . |
157,336 | 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 . |
157,337 | 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 |
157,338 | 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 . |
157,339 | public void clear ( ) { try { file . setLength ( header . size ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } | Clears this PageFile . |
157,340 | 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 . |
157,341 | 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 . |
157,342 | public double getDistance ( final DBIDRef o1 , final DBIDRef o2 ) { return FastMath . sqrt ( getSquaredDistance ( o1 , o2 ) ) ; } | Returns the kernel distance between the two specified objects . |
157,343 | 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 . |
157,344 | public double getSimilarity ( DBIDRef id1 , DBIDRef id2 ) { return kernel [ idmap . getOffset ( id1 ) ] [ idmap . getOffset ( id2 ) ] ; } | Get the kernel similarity for the given objects . |
157,345 | 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 . |
157,346 | 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 . |
157,347 | 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 . |
157,348 | 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 . |
157,349 | 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 . |
157,350 | 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 . |
157,351 | 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 . |
157,352 | 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 |
157,353 | 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 |
157,354 | public static double cdf ( double val , double mu , double beta ) { return FastMath . exp ( - FastMath . exp ( - ( val - mu ) / beta ) ) ; } | CDF of Gumbel distribution |
157,355 | public static double quantile ( double val , double mu , double beta ) { return mu - beta * FastMath . log ( - FastMath . log ( val ) ) ; } | Quantile function of Gumbel distribution |
157,356 | 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 . |
157,357 | 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 . |
157,358 | 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 . |
157,359 | 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 . |
157,360 | 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 . |
157,361 | public Clustering < DendrogramModel > run ( PointerHierarchyRepresentationResult pointerresult ) { Clustering < DendrogramModel > result = new Instance ( pointerresult ) . run ( ) ; result . addChildResult ( pointerresult ) ; return result ; } | Process an existing result . |
157,362 | 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 . |
157,363 | 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 . |
157,364 | 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 . |
157,365 | 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 . |
157,366 | public void setTotal ( int total ) throws IllegalArgumentException { if ( getProcessed ( ) > total ) { throw new IllegalArgumentException ( getProcessed ( ) + " exceeds total: " + total ) ; } this . total = total ; } | Modify the total value . |
157,367 | @ 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 . |
157,368 | @ 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 . |
157,369 | 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 . |
157,370 | 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 . |
157,371 | void initializeRandomAttributes ( SimpleTypeInformation < V > in ) { int d = ( ( VectorFieldTypeInformation < V > ) in ) . getDimensionality ( ) ; selectedAttributes = BitsUtil . random ( k , d , rnd . getSingleThreadedRandom ( ) ) ; } | Initialize random attributes . |
157,372 | 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 . |
157,373 | 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 . |
157,374 | 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 . |
157,375 | 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 . |
157,376 | 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 |
157,377 | 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 . |
157,378 | 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 . |
157,379 | 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 . |
157,380 | 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 |
157,381 | 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 . |
157,382 | 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 . |
157,383 | 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 . |
157,384 | 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 . |
157,385 | 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 . |
157,386 | public N getNode ( int nodeID ) { if ( nodeID == getPageID ( rootEntry ) ) { return getRoot ( ) ; } else { return file . readPage ( nodeID ) ; } } | Returns the node with the specified id . |
157,387 | 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 . |
157,388 | 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 . |
157,389 | 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 |
157,390 | public double getWeight ( double distance , double max , double stddev ) { if ( stddev <= 0 ) { return 1 ; } double scaleddistance = distance / stddev ; return stddev * FastMath . exp ( - .5 * scaleddistance ) ; } | Get exponential weight max is ignored . |
157,391 | protected static < A > int [ ] sortedIndex ( final NumberArrayAdapter < ? , A > adapter , final A data , int len ) { int [ ] s1 = MathUtil . sequence ( 0 , len ) ; IntegerArrayQuickSort . sort ( s1 , ( x , y ) -> Double . compare ( adapter . getDouble ( data , x ) , adapter . getDouble ( data , y ) ) ) ; return s1 ; } | Build a sorted index of objects . |
157,392 | protected static < A > int [ ] discretize ( NumberArrayAdapter < ? , A > adapter , A data , final int len , final int bins ) { double min = adapter . getDouble ( data , 0 ) , max = min ; for ( int i = 1 ; i < len ; i ++ ) { double v = adapter . getDouble ( data , i ) ; if ( v < min ) { min = v ; } else if ( v > max ) {... | Discretize a data set into equi - width bin numbers . |
157,393 | protected void finishGridRow ( ) { GridBagConstraints constraints = new GridBagConstraints ( ) ; constraints . gridwidth = GridBagConstraints . REMAINDER ; constraints . weightx = 0 ; final JLabel icon ; if ( param . isOptional ( ) ) { if ( param . isDefined ( ) && param . tookDefaultValue ( ) && ! ( param instanceof F... | Complete the current grid row adding the icon at the end |
157,394 | private double normalize ( int d , double val ) { d = ( mean . length == 1 ) ? 0 : d ; return ( val - mean [ d ] ) / stddev [ d ] ; } | Normalize a single dimension . |
157,395 | private static EigenPair [ ] processDecomposition ( EigenvalueDecomposition evd ) { double [ ] eigenvalues = evd . getRealEigenvalues ( ) ; double [ ] [ ] eigenvectors = evd . getV ( ) ; EigenPair [ ] eigenPairs = new EigenPair [ eigenvalues . length ] ; for ( int i = 0 ; i < eigenvalues . length ; i ++ ) { double e = ... | Convert an eigenvalue decomposition into EigenPair objects . |
157,396 | public void nextIteration ( double [ ] [ ] means ) { this . means = means ; changed = false ; final int k = means . length ; final int dim = means [ 0 ] . length ; centroids = new double [ k ] [ dim ] ; sizes = new int [ k ] ; Arrays . fill ( varsum , 0. ) ; } | Initialize for a new iteration . |
157,397 | public double [ ] [ ] getMeans ( ) { double [ ] [ ] newmeans = new double [ centroids . length ] [ ] ; for ( int i = 0 ; i < centroids . length ; i ++ ) { if ( sizes [ i ] == 0 ) { newmeans [ i ] = means [ i ] ; continue ; } newmeans [ i ] = centroids [ i ] ; } return newmeans ; } | Get the new means . |
157,398 | public static String format ( double [ ] v , int w , int d ) { DecimalFormat format = new DecimalFormat ( ) ; format . setDecimalFormatSymbols ( new DecimalFormatSymbols ( Locale . US ) ) ; format . setMinimumIntegerDigits ( 1 ) ; format . setMaximumFractionDigits ( d ) ; format . setMinimumFractionDigits ( d ) ; forma... | Returns a string representation of this vector . |
157,399 | public static StringBuilder formatTo ( StringBuilder buf , double [ ] d , String sep ) { if ( d == null ) { return buf . append ( "null" ) ; } if ( d . length == 0 ) { return buf ; } buf . append ( d [ 0 ] ) ; for ( int i = 1 ; i < d . length ; i ++ ) { buf . append ( sep ) . append ( d [ i ] ) ; } return buf ; } | Formats the double array d with the default number format . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.