idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
157,700 | public static double logcdf ( double val , double shape1 , double shape2 ) { if ( val == Double . NEGATIVE_INFINITY ) { return Double . NEGATIVE_INFINITY ; } if ( val == Double . POSITIVE_INFINITY ) { return 0. ; } if ( val != val ) { return Double . NaN ; } if ( shape1 == 0. ) { val = FastMath . exp ( - val ) ; } else... | Cumulative density function for location = 0 scale = 1 |
157,701 | private double naiveQuerySparse ( SparseNumberVector obj , WritableDoubleDataStore scores , HashSetModifiableDBIDs cands ) { double len = 0. ; for ( int iter = obj . iter ( ) ; obj . iterValid ( iter ) ; iter = obj . iterAdvance ( iter ) ) { final int dim = obj . iterDim ( iter ) ; final double val = obj . iterDoubleVa... | Query the most similar objects sparse version . |
157,702 | private double naiveQueryDense ( NumberVector obj , WritableDoubleDataStore scores , HashSetModifiableDBIDs cands ) { double len = 0. ; for ( int dim = 0 , max = obj . getDimensionality ( ) ; dim < max ; dim ++ ) { final double val = obj . doubleValue ( dim ) ; if ( val == 0. || val != val ) { continue ; } len += val *... | Query the most similar objects dense version . |
157,703 | private double naiveQuery ( V obj , WritableDoubleDataStore scores , HashSetModifiableDBIDs cands ) { if ( obj instanceof SparseNumberVector ) { return naiveQuerySparse ( ( SparseNumberVector ) obj , scores , cands ) ; } else { return naiveQueryDense ( obj , scores , cands ) ; } } | Query the most similar objects abstract version . |
157,704 | protected BundleStreamSource invokeStreamFilters ( BundleStreamSource stream ) { assert ( stream != null ) ; if ( filters == null ) { return stream ; } MultipleObjectsBundle bundle = null ; for ( ObjectFilter filter : filters ) { if ( filter instanceof StreamFilter ) { stream = ( ( StreamFilter ) filter ) . init ( bund... | Transforms the specified list of objects and their labels into a list of objects and their associations . |
157,705 | private void inferCallerELKI ( ) { needToInferCaller = false ; StackTraceElement [ ] stack = ( new Throwable ( ) ) . getStackTrace ( ) ; int ix = 0 ; while ( ix < stack . length ) { StackTraceElement frame = stack [ ix ] ; final String cls = frame . getClassName ( ) ; if ( cls . equals ( START_TRACE_AT ) ) { break ; } ... | Infer a caller ignoring logging - related classes . |
157,706 | public static SamplingResult getSamplingResult ( final Relation < ? > rel ) { Collection < SamplingResult > selections = ResultUtil . filterResults ( rel . getHierarchy ( ) , rel , SamplingResult . class ) ; if ( selections . isEmpty ( ) ) { final SamplingResult newsam = new SamplingResult ( rel ) ; ResultUtil . addChi... | Get the sampling result attached to a relation |
157,707 | public Element render ( SVGPlot svgp ) { Element tag = svgp . svgElement ( SVGConstants . SVG_G_TAG ) ; Element button = svgp . svgRect ( x , y , w , h ) ; if ( ! Double . isNaN ( r ) ) { SVGUtil . setAtt ( button , SVGConstants . SVG_RX_ATTRIBUTE , r ) ; SVGUtil . setAtt ( button , SVGConstants . SVG_RY_ATTRIBUTE , r ... | Produce the actual SVG elements for the button . |
157,708 | public void setTitle ( String title , String textcolor ) { this . title = title ; if ( titlecss == null ) { titlecss = new CSSClass ( this , "text" ) ; titlecss . setStatement ( SVGConstants . CSS_TEXT_ANCHOR_PROPERTY , SVGConstants . CSS_MIDDLE_VALUE ) ; titlecss . setStatement ( SVGConstants . CSS_FILL_PROPERTY , tex... | Set the button title |
157,709 | private Pair < PlotItem , VisualizationTask > key ( PlotItem item , VisualizationTask task ) { return new Pair < > ( item , task ) ; } | Helper function for building a key object |
157,710 | private Pair < Element , Visualization > value ( Element elem , Visualization vis ) { return new Pair < > ( elem , vis ) ; } | Helper function to build a value pair |
157,711 | public void put ( PlotItem it , VisualizationTask task , Element elem , Visualization vis ) { map . put ( key ( it , task ) , value ( elem , vis ) ) ; } | Put a new combination into the map . |
157,712 | public Pair < Element , Visualization > remove ( PlotItem it , VisualizationTask task ) { return map . remove ( key ( it , task ) ) ; } | Remove a combination . |
157,713 | public void put ( PlotItem it , VisualizationTask task , Pair < Element , Visualization > pair ) { map . put ( key ( it , task ) , pair ) ; } | Put a new item into the visualizations |
157,714 | public double coveringRadiusFromEntries ( DBID routingObjectID , AbstractMTree < O , N , E , ? > mTree ) { double coveringRadius = 0. ; for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { E entry = getEntry ( i ) ; final double cover = entry . getParentDistance ( ) + entry . getCoveringRadius ( ) ; coveringRadius = cove... | Determines and returns the covering radius of this node . |
157,715 | public static double quadraticEuclidean ( double [ ] v1 , double [ ] v2 ) { final double d1 = v1 [ 0 ] - v2 [ 0 ] , d2 = v1 [ 1 ] - v2 [ 1 ] ; return ( d1 * d1 ) + ( d2 * d2 ) ; } | Squared euclidean distance . 2d . |
157,716 | protected void aggregateSpecial ( T value , int bin ) { final T exist = getSpecial ( bin ) ; special [ bin ] = aggregate ( exist , value ) ; } | Aggregate for a special value . |
157,717 | protected void removePreviousRelation ( Relation < ? > relation ) { if ( keep ) { return ; } boolean first = true ; for ( It < Index > it = relation . getHierarchy ( ) . iterDescendants ( relation ) . filter ( Index . class ) ; it . valid ( ) ; it . advance ( ) ) { if ( first ) { Logging . getLogger ( getClass ( ) ) . ... | Remove the previous relation . |
157,718 | protected double [ ] kNNDistances ( ) { int k = getEntry ( 0 ) . getKnnDistances ( ) . length ; double [ ] result = new double [ k ] ; for ( int i = 0 ; i < getNumEntries ( ) ; i ++ ) { for ( int j = 0 ; j < k ; j ++ ) { MkTabEntry entry = getEntry ( i ) ; result [ j ] = Math . max ( result [ j ] , entry . getKnnDistan... | Determines and returns the knn distance of this node as the maximum knn distance of all entries . |
157,719 | public OutlierResult run ( Database database , Relation < O > relation ) { StepProgress stepprog = LOG . isVerbose ( ) ? new StepProgress ( "VOV" , 3 ) : null ; DBIDs ids = relation . getDBIDs ( ) ; int dim = RelationUtil . dimensionality ( relation ) ; LOG . beginStep ( stepprog , 1 , "Materializing nearest-neighbor s... | Runs the VOV algorithm on the given database . |
157,720 | private void computeVOVs ( KNNQuery < O > knnq , DBIDs ids , DoubleDataStore vols , WritableDoubleDataStore vovs , DoubleMinMax vovminmax ) { FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "Variance of Volume" , ids . size ( ) , LOG ) : null ; boolean warned = false ; for ( DBIDIter iter = ids . iter ... | Compute variance of volumes . |
157,721 | private void boundSize ( HashSetModifiableDBIDs set , int items ) { if ( set . size ( ) > items ) { DBIDs sample = DBIDUtil . randomSample ( set , items , rnd ) ; set . clear ( ) ; set . addDBIDs ( sample ) ; } } | Bound the size of a set by random sampling . |
157,722 | private boolean add ( DBIDRef cur , DBIDRef cand , double distance ) { KNNHeap neighbors = store . get ( cur ) ; if ( neighbors . contains ( cand ) ) { return false ; } double newKDistance = neighbors . insert ( distance , cand ) ; return ( distance <= newKDistance ) ; } | Add cand to cur s heap neighbors with distance |
157,723 | private int sampleNew ( DBIDs ids , WritableDataStore < HashSetModifiableDBIDs > sampleNewNeighbors , WritableDataStore < HashSetModifiableDBIDs > newNeighborHash , int items ) { int t = 0 ; for ( DBIDIter iditer = ids . iter ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { KNNHeap realNeighbors = store . get ( idit... | samples newNeighbors for every object |
157,724 | private void reverse ( WritableDataStore < HashSetModifiableDBIDs > sampleNewHash , WritableDataStore < HashSetModifiableDBIDs > newReverseNeighbors , WritableDataStore < HashSetModifiableDBIDs > oldReverseNeighbors ) { for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { KNN... | calculates new and old neighbors for database |
157,725 | public static double similarityNumberVector ( NumberVector o1 , NumberVector o2 ) { final int d1 = o1 . getDimensionality ( ) , d2 = o2 . getDimensionality ( ) ; int intersection = 0 , union = 0 ; int d = 0 ; for ( ; d < d1 && d < d2 ; d ++ ) { double v1 = o1 . doubleValue ( d ) , v2 = o2 . doubleValue ( d ) ; if ( v1 ... | Compute Jaccard similarity for two number vectors . |
157,726 | protected final Map < DBID , KNNList > batchNN ( N node , DBIDs ids , int kmax ) { Map < DBID , KNNList > res = new HashMap < > ( ids . size ( ) ) ; for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { DBID id = DBIDUtil . deref ( iter ) ; res . put ( id , knnq . getKNNForDBID ( id , kmax ) ... | Performs a batch k - nearest neighbor query for a list of query objects . |
157,727 | void writeResult ( PrintStream out , DBIDs ids , OutlierResult result , ScalingFunction scaling , String label ) { if ( scaling instanceof OutlierScaling ) { ( ( OutlierScaling ) scaling ) . prepare ( result ) ; } out . append ( label ) ; DoubleRelation scores = result . getScores ( ) ; for ( DBIDIter iter = ids . iter... | Write a single output line . |
157,728 | private void runForEachK ( String prefix , int mink , int maxk , IntFunction < OutlierResult > runner , BiConsumer < String , OutlierResult > out ) { if ( isDisabled ( prefix ) ) { LOG . verbose ( "Skipping (disabled): " + prefix ) ; return ; } LOG . verbose ( "Running " + prefix ) ; final int digits = ( int ) FastMath... | Iterate over the k range . |
157,729 | public double [ ] getCoefficients ( ) { double [ ] result = new double [ b . length ] ; System . arraycopy ( b , 0 , result , 0 , b . length ) ; return result ; } | Returns a copy of the the array of coefficients b0 ... bp . |
157,730 | public double getValueAt ( int k ) { double result = 0. ; double log_k = FastMath . log ( k ) , acc = 1. ; for ( int p = 0 ; p < b . length ; p ++ ) { result += b [ p ] * acc ; acc *= log_k ; } return result ; } | Returns the function value of the polynomial approximation at the specified k . |
157,731 | @ SuppressWarnings ( "unchecked" ) private static < V extends FeatureVector < F > , F > ArrayAdapter < F , ? super V > getAdapter ( Factory < V , F > factory ) { if ( factory instanceof NumberVector . Factory ) { return ( ArrayAdapter < F , ? super V > ) NumberVectorAdapter . STATIC ; } return ( ArrayAdapter < F , ? su... | Choose the best adapter for this . |
157,732 | protected void expandClusterOrder ( DBID ipt , ClusterOrder order , DistanceQuery < V > dq , FiniteProgress prog ) { UpdatableHeap < OPTICSHeapEntry > heap = new UpdatableHeap < > ( ) ; heap . add ( new OPTICSHeapEntry ( ipt , null , Double . POSITIVE_INFINITY ) ) ; while ( ! heap . isEmpty ( ) ) { final OPTICSHeapEntr... | OPTICS algorithm for processing a point but with different density estimates |
157,733 | public synchronized void resizeMatrix ( int newsize ) throws IOException { if ( newsize >= 0xFFFF ) { throw new RuntimeException ( "Matrix size is too big and will overflow the integer datatype." ) ; } if ( ! array . isWritable ( ) ) { throw new IOException ( "Can't resize a read-only array." ) ; } array . resizeFile (... | Resize the matrix to cover newsize x newsize . |
157,734 | private int computeOffset ( int x , int y ) { if ( y > x ) { return computeOffset ( y , x ) ; } return ( ( x * ( x + 1 ) ) >> 1 ) + y ; } | Compute the offset within the file . |
157,735 | private void validateHeader ( boolean validateRecordSize ) throws IOException { int readmagic = file . readInt ( ) ; if ( readmagic != this . magic ) { file . close ( ) ; throw new IOException ( "Magic in LinearDiskCache does not match: " + readmagic + " instead of " + this . magic ) ; } if ( file . readInt ( ) != this... | Validates the header and throws an IOException if the header is invalid . If validateRecordSize is set to true the record size must match exactly the stored record size within the files header else the record size is read from the header and used . |
157,736 | public synchronized void resizeFile ( int newsize ) throws IOException { if ( ! writable ) { throw new IOException ( "File is not writeable!" ) ; } this . numrecs = newsize ; file . seek ( HEADER_POS_SIZE ) ; file . writeInt ( numrecs ) ; file . setLength ( indexToFileposition ( numrecs ) ) ; mapArray ( ) ; } | Resize file to the intended size |
157,737 | public synchronized ByteBuffer getExtraHeader ( ) throws IOException { final int size = headersize - INTERNAL_HEADER_SIZE ; final MapMode mode = writable ? MapMode . READ_WRITE : MapMode . READ_ONLY ; return file . getChannel ( ) . map ( mode , INTERNAL_HEADER_SIZE , size ) ; } | Read the extra header data . |
157,738 | public PointerPrototypeHierarchyRepresentationResult run ( Database db , Relation < O > relation ) { DistanceQuery < O > dq = DatabaseUtil . precomputedDistanceQuery ( db , relation , getDistanceFunction ( ) , LOG ) ; final DBIDs ids = relation . getDBIDs ( ) ; final int size = ids . size ( ) ; PointerHierarchyRepresen... | Run the algorithm on a database . |
157,739 | protected static < O > void initializeMatrices ( MatrixParadigm mat , ArrayModifiableDBIDs prots , DistanceQuery < O > dq ) { final DBIDArrayIter ix = mat . ix , iy = mat . iy ; final double [ ] distances = mat . matrix ; int pos = 0 ; for ( ix . seek ( 0 ) ; ix . valid ( ) ; ix . advance ( ) ) { for ( iy . seek ( 0 ) ... | Initializes the inter - cluster distance matrix of possible merges |
157,740 | protected static int findMerge ( int end , MatrixParadigm mat , DBIDArrayMIter prots , PointerHierarchyRepresentationBuilder builder , Int2ObjectOpenHashMap < ModifiableDBIDs > clusters , DistanceQuery < ? > dq ) { final DBIDArrayIter ix = mat . ix , iy = mat . iy ; final double [ ] distances = mat . matrix ; double mi... | Find the best merge . |
157,741 | protected static void merge ( int size , MatrixParadigm mat , DBIDArrayMIter prots , PointerHierarchyRepresentationBuilder builder , Int2ObjectOpenHashMap < ModifiableDBIDs > clusters , DistanceQuery < ? > dq , int x , int y ) { assert ( y < x ) ; final DBIDArrayIter ix = mat . ix . seek ( x ) , iy = mat . iy . seek ( ... | Merges two clusters given by x y their points with smallest IDs and y to keep |
157,742 | protected static < O > void updateMatrices ( int size , MatrixParadigm mat , DBIDArrayMIter prots , PointerHierarchyRepresentationBuilder builder , Int2ObjectOpenHashMap < ModifiableDBIDs > clusters , DistanceQuery < O > dq , int c ) { final DBIDArrayIter ix = mat . ix , iy = mat . iy ; ix . seek ( c ) ; for ( iy . see... | Update the entries of the matrices that contain a distance to c the newly merged cluster . |
157,743 | protected static void updateEntry ( MatrixParadigm mat , DBIDArrayMIter prots , Int2ObjectOpenHashMap < ModifiableDBIDs > clusters , DistanceQuery < ? > dq , int x , int y ) { assert ( y < x ) ; final DBIDArrayIter ix = mat . ix , iy = mat . iy ; final double [ ] distances = mat . matrix ; ModifiableDBIDs cx = clusters... | Update entry at x y for distance matrix distances |
157,744 | private static double findMax ( DistanceQuery < ? > dq , DBIDIter i , DBIDs cy , double maxDist , double minMaxDist ) { for ( DBIDIter j = cy . iter ( ) ; j . valid ( ) ; j . advance ( ) ) { double dist = dq . distance ( i , j ) ; if ( dist > maxDist ) { if ( dist >= minMaxDist ) { return dist ; } maxDist = dist ; } } ... | Find the maximum distance of one object to a set . |
157,745 | public void writeExternal ( ObjectOutput out ) throws IOException { out . writeInt ( DBIDUtil . asInteger ( id ) ) ; out . writeInt ( values . length ) ; for ( double v : values ) { out . writeDouble ( v ) ; } } | Calls the super method and writes the values of this entry to the specified stream . |
157,746 | public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { id = DBIDUtil . importInteger ( in . read ( ) ) ; values = new double [ in . readInt ( ) ] ; for ( int d = 0 ; d < values . length ; d ++ ) { values [ d ] = in . readDouble ( ) ; } } | Calls the super method and reads the values of this entry from the specified input stream . |
157,747 | public StringBuilder appendToBuffer ( StringBuilder buf ) { buf . append ( getTask ( ) ) ; buf . append ( ": " ) ; buf . append ( getProcessed ( ) ) ; return buf ; } | Serialize indefinite progress . |
157,748 | private TypeInformation getInputTypeRestriction ( ) { int m = dims [ 0 ] ; for ( int i = 1 ; i < dims . length ; i ++ ) { m = Math . max ( dims [ i ] , m ) ; } return VectorFieldTypeInformation . typeRequest ( NumberVector . class , m , Integer . MAX_VALUE ) ; } | The input type we use . |
157,749 | private boolean isLocalMaximum ( double kdist , DBIDs neighbors , WritableDoubleDataStore kdists ) { for ( DBIDIter it = neighbors . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { if ( kdists . doubleValue ( it ) < kdist ) { return false ; } } return true ; } | Test if a point is a local density maximum . |
157,750 | protected int expandCluster ( final int clusterid , final WritableIntegerDataStore clusterids , final KNNQuery < O > knnq , final DBIDs neighbors , final double maxkdist , final FiniteProgress progress ) { int clustersize = 1 ; final ArrayModifiableDBIDs activeSet = DBIDUtil . newArray ( ) ; activeSet . addDBIDs ( neig... | Set - based expand cluster implementation . |
157,751 | private void fillDensities ( KNNQuery < O > knnq , DBIDs ids , WritableDoubleDataStore dens ) { FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "Densities" , ids . size ( ) , LOG ) : null ; for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { final KNNList neighbors = knnq .... | Collect all densities into an array for sorting . |
157,752 | public Clustering < SubspaceModel > run ( Relation < ? extends NumberVector > relation ) { final int dimensionality = RelationUtil . dimensionality ( relation ) ; StepProgress step = new StepProgress ( 2 ) ; step . beginStep ( 1 , "Identification of subspaces that contain clusters" , LOG ) ; ArrayList < List < CLIQUESu... | Performs the CLIQUE algorithm on the given database . |
157,753 | private List < Pair < Subspace , ModifiableDBIDs > > determineClusters ( List < CLIQUESubspace > denseSubspaces ) { List < Pair < Subspace , ModifiableDBIDs > > clusters = new ArrayList < > ( ) ; for ( CLIQUESubspace subspace : denseSubspaces ) { List < Pair < Subspace , ModifiableDBIDs > > clustersInSubspace = subspac... | Determines the clusters in the specified dense subspaces . |
157,754 | private List < CLIQUESubspace > findOneDimensionalDenseSubspaces ( Relation < ? extends NumberVector > database ) { List < CLIQUESubspace > denseSubspaceCandidates = findOneDimensionalDenseSubspaceCandidates ( database ) ; return prune ? pruneDenseSubspaces ( denseSubspaceCandidates ) : denseSubspaceCandidates ; } | Determines the one dimensional dense subspaces and performs a pruning if this option is chosen . |
157,755 | private void updateMinMax ( NumberVector featureVector , double [ ] minima , double [ ] maxima ) { assert ( minima . length == featureVector . getDimensionality ( ) ) ; for ( int d = 0 ; d < featureVector . getDimensionality ( ) ; d ++ ) { double v = featureVector . doubleValue ( d ) ; if ( v == v ) { maxima [ d ] = Ma... | Updates the minima and maxima array according to the specified feature vector . |
157,756 | private List < CLIQUESubspace > findOneDimensionalDenseSubspaceCandidates ( Relation < ? extends NumberVector > database ) { Collection < CLIQUEUnit > units = initOneDimensionalUnits ( database ) ; double total = database . size ( ) ; for ( DBIDIter it = database . iterDBIDs ( ) ; it . valid ( ) ; it . advance ( ) ) { ... | Determines the one - dimensional dense subspace candidates by making a pass over the database . |
157,757 | private List < CLIQUESubspace > pruneDenseSubspaces ( List < CLIQUESubspace > denseSubspaces ) { int [ ] [ ] means = computeMeans ( denseSubspaces ) ; double [ ] [ ] diffs = computeDiffs ( denseSubspaces , means [ 0 ] , means [ 1 ] ) ; double [ ] codeLength = new double [ denseSubspaces . size ( ) ] ; double minCL = Do... | Performs a MDL - based pruning of the specified dense subspaces as described in the CLIQUE algorithm . |
157,758 | private int [ ] [ ] computeMeans ( List < CLIQUESubspace > denseSubspaces ) { int n = denseSubspaces . size ( ) - 1 ; int [ ] mi = new int [ n + 1 ] , mp = new int [ n + 1 ] ; double resultMI = 0 , resultMP = 0 ; for ( int i = 0 ; i < denseSubspaces . size ( ) ; i ++ ) { resultMI += denseSubspaces . get ( i ) . getCove... | The specified sorted list of dense subspaces is divided into the selected set I and the pruned set P . For each set the mean of the cover fractions is computed . |
157,759 | private double [ ] [ ] computeDiffs ( List < CLIQUESubspace > denseSubspaces , int [ ] mi , int [ ] mp ) { int n = denseSubspaces . size ( ) - 1 ; double [ ] diff_mi = new double [ n + 1 ] , diff_mp = new double [ n + 1 ] ; double resultMI = 0 , resultMP = 0 ; for ( int i = 0 ; i < denseSubspaces . size ( ) ; i ++ ) { ... | The specified sorted list of dense subspaces is divided into the selected set I and the pruned set P . For each set the difference from the specified mean values is computed . |
157,760 | public void append ( SimpleTypeInformation < ? > meta , Object data ) { this . meta . add ( meta ) ; this . contents . add ( data ) ; } | Append a single representation to the object . |
157,761 | public boolean contains ( long [ ] bitset ) { for ( int i = 0 ; i < bitset . length ; i ++ ) { final long b = bitset [ i ] ; if ( i >= bits . length && b != 0L ) { return false ; } if ( ( b & bits [ i ] ) != b ) { return false ; } } return true ; } | Returns whether this BitVector contains all bits that are set to true in the specified BitSet . |
157,762 | public double jaccardSimilarity ( BitVector v2 ) { return BitsUtil . intersectionSize ( bits , v2 . bits ) / ( double ) BitsUtil . unionSize ( bits , v2 . bits ) ; } | Compute the Jaccard similarity of two bit vectors . |
157,763 | public static int writeShort ( byte [ ] array , int offset , int v ) { array [ offset + 0 ] = ( byte ) ( v >>> 8 ) ; array [ offset + 1 ] = ( byte ) ( v >>> 0 ) ; return SIZE_SHORT ; } | Write a short to the byte array at the given offset . |
157,764 | public static int writeInt ( byte [ ] array , int offset , int v ) { array [ offset + 0 ] = ( byte ) ( v >>> 24 ) ; array [ offset + 1 ] = ( byte ) ( v >>> 16 ) ; array [ offset + 2 ] = ( byte ) ( v >>> 8 ) ; array [ offset + 3 ] = ( byte ) ( v >>> 0 ) ; return SIZE_INT ; } | Write an integer to the byte array at the given offset . |
157,765 | public static int writeLong ( byte [ ] array , int offset , long v ) { array [ offset + 0 ] = ( byte ) ( v >>> 56 ) ; array [ offset + 1 ] = ( byte ) ( v >>> 48 ) ; array [ offset + 2 ] = ( byte ) ( v >>> 40 ) ; array [ offset + 3 ] = ( byte ) ( v >>> 32 ) ; array [ offset + 4 ] = ( byte ) ( v >>> 24 ) ; array [ offset... | Write a long to the byte array at the given offset . |
157,766 | public static int writeFloat ( byte [ ] array , int offset , float v ) { return writeInt ( array , offset , Float . floatToIntBits ( v ) ) ; } | Write a float to the byte array at the given offset . |
157,767 | public static int writeDouble ( byte [ ] array , int offset , double v ) { return writeLong ( array , offset , Double . doubleToLongBits ( v ) ) ; } | Write a double to the byte array at the given offset . |
157,768 | public static short readShort ( byte [ ] array , int offset ) { int b0 = array [ offset + 0 ] & 0xFF ; int b1 = array [ offset + 1 ] & 0xFF ; return ( short ) ( ( b0 << 8 ) + ( b1 << 0 ) ) ; } | Read a short from the byte array at the given offset . |
157,769 | public static int readUnsignedShort ( byte [ ] array , int offset ) { int b0 = array [ offset + 0 ] & 0xFF ; int b1 = array [ offset + 1 ] & 0xFF ; return ( ( b0 << 8 ) + ( b1 << 0 ) ) ; } | Read an unsigned short from the byte array at the given offset . |
157,770 | public static int readInt ( byte [ ] array , int offset ) { int b0 = array [ offset + 0 ] & 0xFF ; int b1 = array [ offset + 1 ] & 0xFF ; int b2 = array [ offset + 2 ] & 0xFF ; int b3 = array [ offset + 3 ] & 0xFF ; return ( ( b0 << 24 ) + ( b1 << 16 ) + ( b2 << 8 ) + ( b3 << 0 ) ) ; } | Read an integer from the byte array at the given offset . |
157,771 | public static long readLong ( byte [ ] array , int offset ) { long b0 = array [ offset + 0 ] ; long b1 = array [ offset + 1 ] & 0xFF ; long b2 = array [ offset + 2 ] & 0xFF ; long b3 = array [ offset + 3 ] & 0xFF ; long b4 = array [ offset + 4 ] & 0xFF ; int b5 = array [ offset + 5 ] & 0xFF ; int b6 = array [ offset + ... | Read a long from the byte array at the given offset . |
157,772 | public static void writeUnsignedVarint ( ByteBuffer buffer , int val ) { while ( ( val & 0x7F ) != val ) { buffer . put ( ( byte ) ( ( val & 0x7F ) | 0x80 ) ) ; val >>>= 7 ; } buffer . put ( ( byte ) ( val & 0x7F ) ) ; } | Write an unsigned integer using a variable - length encoding . |
157,773 | public static void writeUnsignedVarintLong ( ByteBuffer buffer , long val ) { while ( ( val & 0x7F ) != val ) { buffer . put ( ( byte ) ( ( val & 0x7F ) | 0x80 ) ) ; val >>>= 7 ; } buffer . put ( ( byte ) ( val & 0x7F ) ) ; } | Write an unsigned long using a variable - length encoding . |
157,774 | public static void writeString ( ByteBuffer buffer , String s ) throws IOException { if ( s == null ) { s = "" ; } ByteArrayUtil . STRING_SERIALIZER . toByteBuffer ( buffer , s ) ; } | Write a string to the buffer . |
157,775 | public static int readUnsignedVarint ( ByteBuffer buffer ) throws IOException { int val = 0 ; int bits = 0 ; while ( true ) { final int data = buffer . get ( ) ; val |= ( data & 0x7F ) << bits ; if ( ( data & 0x80 ) == 0 ) { return val ; } bits += 7 ; if ( bits > 35 ) { throw new IOException ( "Variable length quantity... | Read an unsigned integer . |
157,776 | public static void unmapByteBuffer ( final MappedByteBuffer map ) { if ( map == null ) { return ; } map . force ( ) ; try { if ( Runtime . class . getDeclaredMethod ( "version" ) != null ) return ; } catch ( NoSuchMethodException e ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Objec... | Unmap a byte buffer . |
157,777 | private void sortAxes ( ) { for ( int d = 0 ; d < shared . dim ; d ++ ) { double dist = shared . camera . squaredDistanceFromCamera ( shared . layout . getNode ( d ) . getX ( ) , shared . layout . getNode ( d ) . getY ( ) ) ; axes [ d ] . first = - dist ; axes [ d ] . second = d ; } Arrays . sort ( axes ) ; for ( int i... | Depth - sort the axes . |
157,778 | private IntIntPair [ ] sortEdges ( int [ ] dindex ) { IntIntPair [ ] edgesort = new IntIntPair [ shared . layout . edges . size ( ) ] ; int e = 0 ; for ( Layout . Edge edge : shared . layout . edges ) { int i1 = dindex [ edge . dim1 ] , i2 = dindex [ edge . dim2 ] ; edgesort [ e ] = new IntIntPair ( Math . min ( i1 , i... | Sort the edges for rendering . |
157,779 | public void finalizeFirstPassE ( ) { double s = 1. / wsum ; for ( int i = 0 ; i < mean . length ; i ++ ) { mean [ i ] *= s ; } } | Finish computation of the mean . |
157,780 | private double restore ( int d , double val ) { d = ( mean . length == 1 ) ? 0 : d ; return val * mean [ d ] ; } | Restore a single dimension . |
157,781 | public OutlierResult run ( Relation < ? extends NumberVector > relation ) { final DBIDs ids = relation . getDBIDs ( ) ; WritableDoubleDataStore ranks = DataStoreUtil . makeDoubleStorage ( ids , DataStoreFactory . HINT_STATIC ) ; DoubleMinMax minmax = new DoubleMinMax ( ) ; KernelDensityEstimator kernel = new KernelDens... | Main loop for OUTRES |
157,782 | public double outresScore ( final int s , long [ ] subspace , DBIDRef id , KernelDensityEstimator kernel , DBIDs cands ) { double score = 1.0 ; final SubspaceEuclideanDistanceFunction df = new SubspaceEuclideanDistanceFunction ( subspace ) ; MeanVariance meanv = new MeanVariance ( ) ; ModifiableDoubleDBIDList neighcand... | Main loop of OUTRES . Run for each object |
157,783 | private DoubleDBIDList initialRange ( DBIDRef obj , DBIDs cands , PrimitiveDistanceFunction < ? super NumberVector > df , double eps , KernelDensityEstimator kernel , ModifiableDoubleDBIDList n ) { n . clear ( ) ; NumberVector o = kernel . relation . get ( obj ) ; final double twoeps = eps * 2 ; int matches = 0 ; for (... | Initial range query . |
157,784 | private DoubleDBIDList subsetNeighborhoodQuery ( DoubleDBIDList neighc , DBIDRef dbid , PrimitiveDistanceFunction < ? super NumberVector > df , double adjustedEps , KernelDensityEstimator kernel , ModifiableDoubleDBIDList n ) { n . clear ( ) ; NumberVector query = kernel . relation . get ( dbid ) ; for ( DoubleDBIDList... | Refine neighbors within a subset . |
157,785 | protected boolean relevantSubspace ( long [ ] subspace , DoubleDBIDList neigh , KernelDensityEstimator kernel ) { final double crit = K_S_CRITICAL001 / FastMath . sqrt ( neigh . size ( ) - 2 ) ; double [ ] data = new double [ neigh . size ( ) ] ; Relation < ? extends NumberVector > relation = kernel . relation ; for ( ... | Subspace relevance test . |
157,786 | public static double of ( double ... data ) { double sum = 0. ; for ( double v : data ) { sum += v ; } return sum / data . length ; } | Static helper function . |
157,787 | @ Reference ( authors = "P. M. Neely" , title = "Comparison of Several Algorithms for Computation of Means, Standard Deviations and Correlation Coefficients" , booktitle = "Communications of the ACM 9(7), 1966" , url = "https://doi.org/10.1145/365719.365958" , bibkey = "doi:10.1145/365719.365958" ) public static double... | Static helper function with extra precision |
157,788 | public void insertAll ( List < E > entries ) { if ( ! initialized && ! entries . isEmpty ( ) ) { initialize ( entries . get ( 0 ) ) ; } for ( E entry : entries ) { insert ( entry , false ) ; } } | Bulk insert . |
157,789 | protected final List < DoubleIntPair > getSortedEntries ( N node , DBID q ) { List < DoubleIntPair > result = new ArrayList < > ( ) ; for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { E entry = node . getEntry ( i ) ; double distance = distance ( entry . getRoutingObjectID ( ) , q ) ; double radius = entry . ge... | Sorts the entries of the specified node according to their minimum distance to the specified object . |
157,790 | public final double distance ( E e1 , E e2 ) { return distance ( e1 . getRoutingObjectID ( ) , e2 . getRoutingObjectID ( ) ) ; } | Returns the distance between the routing object of two entries . |
157,791 | public static < A > double [ ] alphaPWM ( A data , NumberArrayAdapter < ? , A > adapter , final int nmom ) { final int n = adapter . size ( data ) ; final double [ ] xmom = new double [ nmom ] ; double weight = 1. / n ; for ( int i = 0 ; i < n ; i ++ ) { final double val = adapter . getDouble ( data , i ) ; xmom [ 0 ] ... | Compute the alpha_r factors using the method of probability - weighted moments . |
157,792 | public static < A > double [ ] alphaBetaPWM ( A data , NumberArrayAdapter < ? , A > adapter , final int nmom ) { final int n = adapter . size ( data ) ; final double [ ] xmom = new double [ nmom << 1 ] ; double aweight = 1. / n , bweight = aweight ; for ( int i = 0 ; i < n ; i ++ ) { final double val = adapter . getDou... | Compute the alpha_r and beta_r factors in parallel using the method of probability - weighted moments . Usually cheaper than computing them separately . |
157,793 | public static < A > double [ ] samLMR ( A sorted , NumberArrayAdapter < ? , A > adapter , int nmom ) { final int n = adapter . size ( sorted ) ; final double [ ] sum = new double [ nmom ] ; nmom = n < nmom ? n : nmom ; for ( int i = 0 ; i < n ; i ++ ) { double term = adapter . getDouble ( sorted , i ) ; if ( Double . i... | Compute the sample L - Moments using probability weighted moments . |
157,794 | private static void normalizeLMR ( double [ ] sum , int nmom ) { for ( int k = nmom - 1 ; k >= 1 ; -- k ) { double p = ( ( k & 1 ) == 0 ) ? + 1 : - 1 ; double temp = p * sum [ 0 ] ; for ( int i = 0 ; i < k ; i ++ ) { double ai = i + 1. ; p *= - ( k + ai ) * ( k - i ) / ( ai * ai ) ; temp += p * sum [ i + 1 ] ; } sum [ ... | Normalize the moments |
157,795 | private int [ ] countItemSupport ( final Relation < BitVector > relation , final int dim ) { final int [ ] counts = new int [ dim ] ; FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "Finding frequent 1-items" , relation . size ( ) , LOG ) : null ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; idit... | Count the support of each 1 - item . |
157,796 | private FPTree buildFPTree ( final Relation < BitVector > relation , int [ ] iidx , final int items ) { FPTree tree = new FPTree ( items ) ; FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "Building FP-tree" , relation . size ( ) , LOG ) : null ; int [ ] buf = new int [ items ] ; for ( DBIDIter iditer ... | Build the actual FP - tree structure . |
157,797 | public StringBuilder appendTo ( StringBuilder buf , VectorFieldTypeInformation < BitVector > meta ) { this . antecedent . appendTo ( buf , meta ) ; buf . append ( " ) ; this . consequent . appendItemsTo ( buf , meta ) ; buf . append ( ": " ) ; buf . append ( union . getSupport ( ) ) ; buf . append ( " : " ) ; buf . ap... | Append to a string buffer . |
157,798 | public void process ( Clustering < ? > result1 , Clustering < ? > result2 ) { final List < ? extends Cluster < ? > > cs1 = result1 . getAllClusters ( ) ; final List < ? extends Cluster < ? > > cs2 = result2 . getAllClusters ( ) ; size1 = cs1 . size ( ) ; size2 = cs2 . size ( ) ; contingency = new int [ size1 + 2 ] [ si... | Process two clustering results . |
157,799 | private long [ ] randomSubspace ( final int alldim , final int mindim , final int maxdim , final Random rand ) { long [ ] dimset = BitsUtil . zero ( alldim ) ; int [ ] dims = new int [ alldim ] ; for ( int d = 0 ; d < alldim ; d ++ ) { dims [ d ] = d ; } int subdim = mindim + rand . nextInt ( maxdim - mindim ) ; for ( ... | Choose a random subspace . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.