idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
158,000
public static double pdf ( double x , double mu , double sigma , double k ) { if ( x == Double . POSITIVE_INFINITY || x == Double . NEGATIVE_INFINITY ) { return 0. ; } x = ( x - mu ) / sigma ; if ( k > 0 || k < 0 ) { if ( k * x > 1 ) { return 0. ; } double t = FastMath . log ( 1 - k * x ) ; return t == Double . NEGATIV...
PDF of GEV distribution
158,001
public static double cdf ( double val , double mu , double sigma , double k ) { final double x = ( val - mu ) / sigma ; if ( k > 0 || k < 0 ) { if ( k * x > 1 ) { return k > 0 ? 1 : 0 ; } return FastMath . exp ( - FastMath . exp ( FastMath . log ( 1 - k * x ) / k ) ) ; } else { return FastMath . exp ( - FastMath . exp ...
CDF of GEV distribution
158,002
public static double quantile ( double val , double mu , double sigma , double k ) { if ( val < 0.0 || val > 1.0 ) { return Double . NaN ; } if ( k < 0 ) { return mu + sigma * Math . max ( ( 1. - FastMath . pow ( - FastMath . log ( val ) , k ) ) / k , 1. / k ) ; } else if ( k > 0 ) { return mu + sigma * Math . min ( ( ...
Quantile function of GEV distribution
158,003
public static double cdf ( double x , double sigma ) { if ( x <= 0. ) { return 0. ; } final double xs = x / sigma ; return 1. - FastMath . exp ( - .5 * xs * xs ) ; }
CDF of Rayleigh distribution
158,004
public static double quantile ( double val , double sigma ) { if ( ! ( val >= 0. ) || ! ( val <= 1. ) ) { return Double . NaN ; } if ( val == 0. ) { return 0. ; } if ( val == 1. ) { return Double . POSITIVE_INFINITY ; } return sigma * FastMath . sqrt ( - 2. * FastMath . log ( 1. - val ) ) ; }
Quantile function of Rayleigh distribution
158,005
public OutlierResult run ( Database db , Relation < V > relation ) { ArrayDBIDs ids = DBIDUtil . ensureArray ( relation . getDBIDs ( ) ) ; SimilarityQuery < V > sq = db . getSimilarityQuery ( relation , kernelFunction ) ; KernelMatrix kernelMatrix = new KernelMatrix ( sq , relation , ids ) ; WritableDoubleDataStore abo...
Run ABOD on the data set .
158,006
protected double computeABOF ( KernelMatrix kernelMatrix , DBIDRef pA , DBIDArrayIter pB , DBIDArrayIter pC , MeanVariance s ) { s . reset ( ) ; double simAA = kernelMatrix . getSimilarity ( pA , pA ) ; for ( pB . seek ( 0 ) ; pB . valid ( ) ; pB . advance ( ) ) { if ( DBIDUtil . equal ( pB , pA ) ) { continue ; } doub...
Compute the exact ABOF value .
158,007
public OutlierResult run ( Database database , Relation < O > relation ) { DBIDs ids = relation . getDBIDs ( ) ; WritableDoubleDataStore store = DataStoreUtil . makeDoubleStorage ( ids , DataStoreFactory . HINT_DB ) ; DistanceQuery < O > distq = database . getDistanceQuery ( relation , getDistanceFunction ( ) ) ; KNNQu...
Run the parallel kNN weight outlier detector .
158,008
public Clustering < ? > run ( final Database database , final Relation < DiscreteUncertainObject > relation ) { if ( relation . size ( ) <= 0 ) { return new Clustering < > ( "Uk-Means Clustering" , "ukmeans-clustering" ) ; } DBIDs sampleids = DBIDUtil . randomSample ( relation . getDBIDs ( ) , k , rnd ) ; List < double...
Run the clustering .
158,009
protected boolean updateAssignment ( DBIDIter iditer , List < ? extends ModifiableDBIDs > clusters , WritableIntegerDataStore assignment , int newA ) { final int oldA = assignment . intValue ( iditer ) ; if ( oldA == newA ) { return false ; } clusters . get ( newA ) . add ( iditer ) ; assignment . putInt ( iditer , new...
Update the cluster assignment .
158,010
protected double getExpectedRepDistance ( NumberVector rep , DiscreteUncertainObject uo ) { SquaredEuclideanDistanceFunction euclidean = SquaredEuclideanDistanceFunction . STATIC ; int counter = 0 ; double sum = 0.0 ; for ( int i = 0 ; i < uo . getNumberSamples ( ) ; i ++ ) { sum += euclidean . distance ( rep , uo . ge...
Get expected distance between a Vector and an uncertain object
158,011
protected void logVarstat ( DoubleStatistic varstat , double [ ] varsum ) { if ( varstat != null ) { double s = sum ( varsum ) ; getLogger ( ) . statistics ( varstat . setDouble ( s ) ) ; } }
Log statistics on the variance sum .
158,012
public void save ( ) throws FileNotFoundException { PrintStream p = new PrintStream ( file ) ; p . println ( COMMENT_PREFIX + "Saved ELKI settings. First line is title, remaining lines are parameters." ) ; for ( Pair < String , ArrayList < String > > settings : store ) { p . println ( settings . first ) ; for ( String ...
Save the current data to the given file .
158,013
public void load ( ) throws FileNotFoundException , IOException { BufferedReader is = new BufferedReader ( new InputStreamReader ( new FileInputStream ( file ) ) ) ; ArrayList < String > buf = new ArrayList < > ( ) ; while ( is . ready ( ) ) { String line = is . readLine ( ) ; if ( line . startsWith ( COMMENT_PREFIX ) ...
Read the current file
158,014
public void remove ( String key ) { Iterator < Pair < String , ArrayList < String > > > it = store . iterator ( ) ; while ( it . hasNext ( ) ) { String thisKey = it . next ( ) . first ; if ( key . equals ( thisKey ) ) { it . remove ( ) ; break ; } } }
Remove a given key from the file .
158,015
public ArrayList < String > get ( String key ) { Iterator < Pair < String , ArrayList < String > > > it = store . iterator ( ) ; while ( it . hasNext ( ) ) { Pair < String , ArrayList < String > > pair = it . next ( ) ; if ( key . equals ( pair . first ) ) { return pair . second ; } } return null ; }
Find a saved setting by key .
158,016
public Clustering < Model > run ( Database database , Relation < V > relation ) { int dim_c = RelationUtil . dimensionality ( relation ) ; if ( dim_c < l ) { throw new IllegalStateException ( "Dimensionality of data < parameter l! " + "(" + dim_c + " < " + l + ")" ) ; } int k_c = Math . min ( relation . size ( ) , k_i ...
Performs the ORCLUS algorithm on the given database .
158,017
private List < ORCLUSCluster > initialSeeds ( Relation < V > database , int k ) { DBIDs randomSample = DBIDUtil . randomSample ( database . getDBIDs ( ) , k , rnd ) ; List < ORCLUSCluster > seeds = new ArrayList < > ( k ) ; for ( DBIDIter iter = randomSample . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { seeds ...
Initializes the list of seeds wit a random sample of size k .
158,018
private void assign ( Relation < V > database , List < ORCLUSCluster > clusters ) { NumberVectorDistanceFunction < ? super V > distFunc = SquaredEuclideanDistanceFunction . STATIC ; for ( ORCLUSCluster cluster : clusters ) { cluster . objectIDs . clear ( ) ; } List < NumberVector > projectedCentroids = new ArrayList < ...
Creates a partitioning of the database by assigning each object to its closest seed .
158,019
private void merge ( Relation < V > relation , List < ORCLUSCluster > clusters , int k_new , int d_new , IndefiniteProgress cprogress ) { ArrayList < ProjectedEnergy > projectedEnergies = new ArrayList < > ( ( clusters . size ( ) * ( clusters . size ( ) - 1 ) ) >>> 1 ) ; for ( int i = 0 ; i < clusters . size ( ) ; i ++...
Reduces the number of seeds to k_new
158,020
private ProjectedEnergy projectedEnergy ( Relation < V > relation , ORCLUSCluster c_i , ORCLUSCluster c_j , int i , int j , int dim ) { NumberVectorDistanceFunction < ? super V > distFunc = SquaredEuclideanDistanceFunction . STATIC ; ORCLUSCluster c_ij = union ( relation , c_i , c_j , dim ) ; double sum = 0. ; NumberVe...
Computes the projected energy of the specified clusters . The projected energy is given by the mean square distance of the points to the centroid of the union cluster c when all points in c are projected to the subspace of c .
158,021
private ORCLUSCluster union ( Relation < V > relation , ORCLUSCluster c1 , ORCLUSCluster c2 , int dim ) { ORCLUSCluster c = new ORCLUSCluster ( ) ; c . objectIDs = DBIDUtil . newHashSet ( c1 . objectIDs ) ; c . objectIDs . addDBIDs ( c2 . objectIDs ) ; c . objectIDs = DBIDUtil . newArray ( c . objectIDs ) ; if ( c . ob...
Returns the union of the two specified clusters .
158,022
private static void initializeNNCache ( double [ ] scratch , double [ ] bestd , int [ ] besti ) { final int size = bestd . length ; Arrays . fill ( bestd , Double . POSITIVE_INFINITY ) ; Arrays . fill ( besti , - 1 ) ; for ( int x = 0 , p = 0 ; x < size ; x ++ ) { assert ( p == MatrixParadigm . triangleSize ( x ) ) ; d...
Initialize the NN cache .
158,023
protected int findMerge ( int size , MatrixParadigm mat , double [ ] bestd , int [ ] besti , PointerHierarchyRepresentationBuilder builder ) { double mindist = Double . POSITIVE_INFINITY ; int x = - 1 , y = - 1 ; for ( int cx = 0 ; cx < size ; cx ++ ) { final int cy = besti [ cx ] ; if ( cy < 0 ) { continue ; } final d...
Perform the next merge step .
158,024
protected void merge ( int size , MatrixParadigm mat , double [ ] bestd , int [ ] besti , PointerHierarchyRepresentationBuilder builder , double mindist , int x , int y ) { final DBIDArrayIter ix = mat . ix . seek ( x ) , iy = mat . iy . seek ( y ) ; if ( LOG . isDebuggingFine ( ) ) { LOG . debugFine ( "Merging: " + DB...
Execute the cluster merge .
158,025
private void updateCache ( int size , double [ ] scratch , double [ ] bestd , int [ ] besti , int x , int y , int j , double d ) { if ( d <= bestd [ j ] ) { bestd [ j ] = d ; besti [ j ] = y ; return ; } if ( besti [ j ] == x || besti [ j ] == y ) { findBest ( size , scratch , bestd , besti , j ) ; } }
Update the cache .
158,026
public VisualizerContext newContext ( ResultHierarchy hier , Result start ) { Collection < Relation < ? > > rels = ResultUtil . filterResults ( hier , Relation . class ) ; for ( Relation < ? > rel : rels ) { if ( samplesize == 0 ) { continue ; } if ( ! ResultUtil . filterResults ( hier , rel , SamplingResult . class ) ...
Make a new visualization context
158,027
public static String getTitle ( Database db , Result result ) { List < TrackedParameter > settings = new ArrayList < > ( ) ; for ( SettingsResult sr : SettingsResult . getSettingsResults ( result ) ) { settings . addAll ( sr . getSettings ( ) ) ; } String algorithm = null ; String distance = null ; String dataset = nul...
Try to automatically generate a title for this .
158,028
protected static String shortenClassname ( String nam , char c ) { final int lastdot = nam . lastIndexOf ( c ) ; if ( lastdot >= 0 ) { nam = nam . substring ( lastdot + 1 ) ; } return nam ; }
Shorten the class name .
158,029
private static Class < ? > getRestrictionClass ( OptionID oid , final Parameter < ? > firstopt , Map < OptionID , List < Pair < Parameter < ? > , Class < ? > > > > byopt ) { Class < ? > superclass = getRestrictionClass ( firstopt ) ; for ( Pair < Parameter < ? > , Class < ? > > clinst : byopt . get ( oid ) ) { if ( cli...
Get the restriction class of an option .
158,030
private static < T > ArrayList < T > sorted ( Collection < T > cls , Comparator < ? super T > c ) { ArrayList < T > sorted = new ArrayList < > ( cls ) ; sorted . sort ( c ) ; return sorted ; }
Sort a collection of classes .
158,031
protected void handleHoverEvent ( Event evt ) { if ( evt . getTarget ( ) instanceof Element ) { Element e = ( Element ) evt . getTarget ( ) ; Node next = e . getNextSibling ( ) ; if ( next instanceof Element ) { toggleTooltip ( ( Element ) next , evt . getType ( ) ) ; } else { LoggingUtil . warning ( "Tooltip sibling n...
Handle the hover events .
158,032
protected void toggleTooltip ( Element elem , String type ) { String csscls = elem . getAttribute ( SVGConstants . SVG_CLASS_ATTRIBUTE ) ; if ( SVGConstants . SVG_MOUSEOVER_EVENT_TYPE . equals ( type ) ) { if ( TOOLTIP_HIDDEN . equals ( csscls ) ) { SVGUtil . setAtt ( elem , SVGConstants . SVG_CLASS_ATTRIBUTE , TOOLTIP...
Toggle the Tooltip of an element .
158,033
public DoubleDBIDList reverseKNNQuery ( DBIDRef id , int k ) { ModifiableDoubleDBIDList result = DBIDUtil . newDistanceDBIDList ( ) ; final Heap < MTreeSearchCandidate > pq = new UpdatableHeap < > ( ) ; pq . add ( new MTreeSearchCandidate ( 0. , getRootID ( ) , null , Double . NaN ) ) ; while ( ! pq . isEmpty ( ) ) { M...
Performs a reverse k - nearest neighbor query for the given object ID . The query result is in ascending order to the distance to the query object .
158,034
private void leafEntryIDs ( MkAppTreeNode < O > node , ModifiableDBIDs result ) { if ( node . isLeaf ( ) ) { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { MkAppEntry entry = node . getEntry ( i ) ; result . add ( ( ( LeafEntry ) entry ) . getDBID ( ) ) ; } } else { for ( int i = 0 ; i < node . getNumEntries...
Determines the ids of the leaf entries stored in the specified subtree .
158,035
private PolynomialApproximation approximateKnnDistances ( double [ ] knnDistances ) { StringBuilder msg = new StringBuilder ( ) ; int k_0 = 0 ; if ( settings . log ) { for ( int i = 0 ; i < settings . kmax ; i ++ ) { double dist = knnDistances [ i ] ; if ( dist == 0 ) { k_0 ++ ; } else { break ; } } } double [ ] x = ne...
Computes the polynomial approximation of the specified knn - distances .
158,036
protected final int isLeft ( double [ ] a , double [ ] b , double [ ] o ) { final double cross = getRX ( a , o ) * getRY ( b , o ) - getRY ( a , o ) * getRX ( b , o ) ; if ( cross == 0 ) { final double dista = Math . abs ( getRX ( a , o ) ) + Math . abs ( getRY ( a , o ) ) ; final double distb = Math . abs ( getRX ( b ...
Test whether a point is left of the other wrt . the origin .
158,037
private double mdist ( double [ ] a , double [ ] b ) { return Math . abs ( a [ 0 ] - b [ 0 ] ) + Math . abs ( a [ 1 ] - b [ 1 ] ) ; }
Manhattan distance .
158,038
private boolean isConvex ( double [ ] a , double [ ] b , double [ ] c ) { double area = ( b [ 0 ] - a [ 0 ] ) * factor * ( c [ 1 ] - a [ 1 ] ) - ( c [ 0 ] - a [ 0 ] ) * factor * ( b [ 1 ] - a [ 1 ] ) ; return ( - 1e-13 < area && area < 1e-13 ) ? ( mdist ( b , c ) > mdist ( a , b ) + mdist ( a , c ) ) : ( area < 0 ) ; }
Simple convexity test .
158,039
private void grahamScan ( ) { if ( points . size ( ) < 3 ) { return ; } Iterator < double [ ] > iter = points . iterator ( ) ; Stack < double [ ] > stack = new Stack < > ( ) ; final double [ ] first = iter . next ( ) ; stack . add ( first ) ; while ( iter . hasNext ( ) ) { double [ ] n = iter . next ( ) ; if ( mdist ( ...
The actual graham scan main loop .
158,040
public Polygon getHull ( ) { if ( ! ok ) { computeConvexHull ( ) ; } return new Polygon ( points , minmaxX . getMin ( ) , minmaxX . getMax ( ) , minmaxY . getMin ( ) , minmaxY . getMax ( ) ) ; }
Compute the convex hull and return the resulting polygon .
158,041
private static double coverRadius ( double [ ] [ ] matrix , int [ ] idx , int i ) { final int idx_i = idx [ i ] ; final double [ ] row_i = matrix [ i ] ; double m = 0 ; for ( int j = 0 ; j < row_i . length ; j ++ ) { if ( i != j && idx_i == idx [ j ] ) { final double d = row_i [ j ] ; m = d > m ? d : m ; } } return m ;...
Find the cover radius of a partition .
158,042
private static int [ ] mstPartition ( double [ ] [ ] matrix ) { final int n = matrix . length ; int [ ] edges = PrimsMinimumSpanningTree . processDense ( matrix ) ; double meanlength = thresholdLength ( matrix , edges ) ; int [ ] idx = new int [ n ] , best = new int [ n ] , sizes = new int [ n ] ; int bestsize = - 1 ; ...
Partition the data using the minimu spanning tree .
158,043
private static double thresholdLength ( double [ ] [ ] matrix , int [ ] edges ) { double [ ] lengths = new double [ edges . length >> 1 ] ; for ( int i = 0 , e = edges . length - 1 ; i < e ; i += 2 ) { lengths [ i >> 1 ] = matrix [ edges [ i ] ] [ edges [ i + 1 ] ] ; } Arrays . sort ( lengths ) ; final int pos = ( leng...
Choose the threshold length of edges to consider omittig .
158,044
private static double edgelength ( double [ ] [ ] matrix , int [ ] edges , int i ) { i <<= 1 ; return matrix [ edges [ i ] ] [ edges [ i + 1 ] ] ; }
Length of edge i .
158,045
private static void omitEdge ( int [ ] edges , int [ ] idx , int [ ] sizes , int omit ) { for ( int i = 0 ; i < idx . length ; i ++ ) { idx [ i ] = i ; } Arrays . fill ( sizes , 1 ) ; for ( int i = 0 , j = 0 , e = edges . length - 1 ; j < e ; i ++ , j += 2 ) { if ( i == omit ) { continue ; } int ea = edges [ j + 1 ] , ...
Partition the data by omitting one edge .
158,046
private static int follow ( int i , int [ ] partitions ) { int next = partitions [ i ] , tmp ; while ( i != next ) { tmp = next ; next = partitions [ i ] = partitions [ next ] ; i = tmp ; } return i ; }
Union - find with simple path compression .
158,047
private static void computeCentroid ( double [ ] centroid , Relation < ? extends NumberVector > relation , DBIDs ids ) { Arrays . fill ( centroid , 0 ) ; int dim = centroid . length ; for ( DBIDIter it = ids . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { NumberVector v = relation . get ( it ) ; for ( int i = 0 ; i ...
Recompute the centroid of a set .
158,048
public static < O > DistanceQuery < O > getDistanceQuery ( Database database , DistanceFunction < ? super O > distanceFunction , Object ... hints ) { final Relation < O > objectQuery = database . getRelation ( distanceFunction . getInputTypeRestriction ( ) , hints ) ; return database . getDistanceQuery ( objectQuery , ...
Get a distance query for a given distance function automatically choosing a relation .
158,049
public static < O > SimilarityQuery < O > getSimilarityQuery ( Database database , SimilarityFunction < ? super O > similarityFunction , Object ... hints ) { final Relation < O > objectQuery = database . getRelation ( similarityFunction . getInputTypeRestriction ( ) , hints ) ; return database . getSimilarityQuery ( ob...
Get a similarity query automatically choosing a relation .
158,050
public static < O > RKNNQuery < O > getRKNNQuery ( Relation < O > relation , DistanceFunction < ? super O > distanceFunction , Object ... hints ) { final DistanceQuery < O > distanceQuery = relation . getDistanceQuery ( distanceFunction , hints ) ; return relation . getRKNNQuery ( distanceQuery , hints ) ; }
Get a rKNN query object for the given distance function .
158,051
public static < O > RangeQuery < O > getLinearScanSimilarityRangeQuery ( SimilarityQuery < O > simQuery ) { if ( simQuery instanceof PrimitiveSimilarityQuery ) { final PrimitiveSimilarityQuery < O > pdq = ( PrimitiveSimilarityQuery < O > ) simQuery ; return new LinearScanPrimitiveSimilarityRangeQuery < > ( pdq ) ; } re...
Get a linear scan query for the given similarity query .
158,052
protected static void register ( Class < ? > parent , String cname ) { Entry e = data . get ( parent ) ; if ( e == null ) { data . put ( parent , e = new Entry ( ) ) ; } e . addName ( cname ) ; }
Register a class with the registry .
158,053
protected static void register ( Class < ? > parent , Class < ? > clazz ) { Entry e = data . get ( parent ) ; if ( e == null ) { data . put ( parent , e = new Entry ( ) ) ; } final String cname = clazz . getCanonicalName ( ) ; e . addHit ( cname , clazz ) ; if ( clazz . isAnnotationPresent ( Alias . class ) ) { Alias a...
Register a class in the registry .
158,054
protected static void registerAlias ( Class < ? > parent , String alias , String cname ) { Entry e = data . get ( parent ) ; assert ( e != null ) ; e . addAlias ( alias , cname ) ; }
Register a class alias with the registry .
158,055
private static Class < ? > tryLoadClass ( String value ) { try { return CLASSLOADER . loadClass ( value ) ; } catch ( ClassNotFoundException e ) { return null ; } }
Attempt to load a class
158,056
public static List < Class < ? > > findAllImplementations ( Class < ? > restrictionClass ) { if ( restrictionClass == null ) { return Collections . emptyList ( ) ; } if ( ! contains ( restrictionClass ) ) { ELKIServiceLoader . load ( restrictionClass ) ; ELKIServiceScanner . load ( restrictionClass ) ; } Entry e = data...
Find all implementations of a particular interface .
158,057
public static List < Class < ? > > findAllImplementations ( Class < ? > c , boolean everything , boolean parameterizable ) { if ( c == null ) { return Collections . emptyList ( ) ; } if ( ! everything && parameterizable ) { return findAllImplementations ( c ) ; } List < Class < ? > > known = findAllImplementations ( c ...
Find all implementations of a given class in the classpath .
158,058
private static < C > Class < ? > tryAlternateNames ( Class < ? super C > restrictionClass , String value , Entry e ) { StringBuilder buf = new StringBuilder ( value . length ( ) + 100 ) ; Class < ? > clazz = tryLoadClass ( buf . append ( value ) . append ( FACTORY_POSTFIX ) . toString ( ) ) ; if ( clazz != null ) { ret...
Try loading alternative names .
158,059
protected Element setupCanvas ( ) { final double margin = context . getStyleLibrary ( ) . getSize ( StyleLibrary . MARGIN ) ; this . layer = setupCanvas ( svgp , this . proj , margin , getWidth ( ) , getHeight ( ) ) ; return layer ; }
Setup our canvas .
158,060
protected SimpleTypeInformation < ? > convertedType ( SimpleTypeInformation < ? > in , NumberVector . Factory < V > factory ) { return new VectorFieldTypeInformation < > ( factory , tdim ) ; }
Get the output type from the input type after conversion .
158,061
protected < O > Map < O , IntList > partition ( List < ? extends O > classcolumn ) { Map < O , IntList > classes = new HashMap < > ( ) ; Iterator < ? extends O > iter = classcolumn . iterator ( ) ; for ( int i = 0 ; iter . hasNext ( ) ; i ++ ) { O lbl = iter . next ( ) ; IntList ids = classes . get ( lbl ) ; if ( ids =...
Partition the bundle based on the class label .
158,062
public Curve makeCurve ( ) { Curve c = new Curve ( curves . size ( ) ) ; curves . add ( c ) ; return c ; }
Make a new curve .
158,063
public void publish ( String message , Level level ) { try { publish ( new LogRecord ( level , message ) ) ; } catch ( BadLocationException e ) { throw new RuntimeException ( "Error writing a log-like message." , e ) ; } }
Print a message as if it were logged without going through the full logger .
158,064
protected synchronized void publish ( LogRecord record ) throws BadLocationException { final Formatter fmt ; final Style style ; if ( record . getLevel ( ) . intValue ( ) >= Level . WARNING . intValue ( ) ) { fmt = errformat ; style = errStyle ; } else if ( record . getLevel ( ) . intValue ( ) <= Level . FINE . intValu...
Publish a log record to the logging pane .
158,065
protected void optimizeSNE ( AffinityMatrix pij , double [ ] [ ] sol ) { final int size = pij . size ( ) ; if ( size * 3L * dim > 0x7FFF_FFFAL ) { throw new AbortException ( "Memory exceeds Java array size limit." ) ; } double [ ] meta = new double [ size * 3 * dim ] ; final int dim3 = dim * 3 ; for ( int off = 2 * dim...
Perform the actual tSNE optimization .
158,066
protected double computeQij ( double [ ] [ ] qij , double [ ] [ ] solution ) { double qij_sum = 0 ; for ( int i = 1 ; i < qij . length ; i ++ ) { final double [ ] qij_i = qij [ i ] , vi = solution [ i ] ; for ( int j = 0 ; j < i ; j ++ ) { qij_sum += qij_i [ j ] = qij [ j ] [ i ] = MathUtil . exp ( - sqDist ( vi , solu...
Compute the qij of the solution and the sum .
158,067
protected void computeGradient ( AffinityMatrix pij , double [ ] [ ] qij , double qij_isum , double [ ] [ ] sol , double [ ] meta ) { final int dim3 = dim * 3 ; int size = pij . size ( ) ; for ( int i = 0 , off = 0 ; i < size ; i ++ , off += dim3 ) { final double [ ] sol_i = sol [ i ] , qij_i = qij [ i ] ; Arrays . fil...
Compute the gradients .
158,068
public OutlierResult run ( Database database , Relation < O > relation ) { DistanceFunction < ? super O > df = clusterer . getDistanceFunction ( ) ; DistanceQuery < O > dq = database . getDistanceQuery ( relation , df ) ; Clustering < ? > c = clusterer . run ( database , relation ) ; WritableDoubleDataStore scores = Da...
Run the outlier detection algorithm .
158,069
public FittingFunctionResult eval ( double x , double [ ] params ) { final int len = params . length ; assert ( len % 3 ) == 0 ; double y = 0.0 ; double [ ] gradients = new double [ len ] ; for ( int i = 2 ; i < params . length ; i += 3 ) { double stdpar = ( x - params [ i - 2 ] ) / params [ i - 1 ] ; double e = FastMa...
Compute the mixture of Gaussians at the given position
158,070
private void showVisualization ( VisualizerContext context , SimilarityMatrixVisualizer factory , VisualizationTask task ) { VisualizationPlot plot = new VisualizationPlot ( ) ; Visualization vis = factory . makeVisualization ( context , task , plot , 1.0 , 1.0 , null ) ; plot . getRoot ( ) . appendChild ( vis . getLay...
Show a single visualization .
158,071
public void put ( int [ ] data ) { final int l = data . length ; for ( int i = 0 ; i < l ; i ++ ) { put ( data [ i ] ) ; } }
Process a whole array of int values .
158,072
public OutlierResult run ( Database database , Relation < O > rel ) { final DBIDs ids = rel . getDBIDs ( ) ; LOG . verbose ( "Running kNN preprocessor." ) ; KNNQuery < O > knnq = DatabaseUtil . precomputedKNNQuery ( database , rel , getDistanceFunction ( ) , kmax + 1 ) ; WritableDataStore < double [ ] > densities = Dat...
Run the KDEOS outlier detection algorithm .
158,073
protected void estimateDensities ( Relation < O > rel , KNNQuery < O > knnq , final DBIDs ids , WritableDataStore < double [ ] > densities ) { final int dim = dimensionality ( rel ) ; final int knum = kmax + 1 - kmin ; for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { densities . put ( it...
Perform the kernel density estimation step .
158,074
private int dimensionality ( Relation < O > rel ) { if ( idim >= 0 ) { return idim ; } @ SuppressWarnings ( "unchecked" ) final Relation < NumberVector > frel = ( Relation < NumberVector > ) rel ; int dim = RelationUtil . dimensionality ( frel ) ; if ( dim < 1 ) { throw new AbortException ( "When using KDEOS with non-v...
Ugly hack to allow using this implementation without having a well - defined dimensionality .
158,075
protected void computeOutlierScores ( KNNQuery < O > knnq , final DBIDs ids , WritableDataStore < double [ ] > densities , WritableDoubleDataStore kdeos , DoubleMinMax minmax ) { final int knum = kmax + 1 - kmin ; FiniteProgress prog = LOG . isVerbose ( ) ? new FiniteProgress ( "Computing KDEOS scores" , ids . size ( )...
Compute the final KDEOS scores .
158,076
public Clustering < Model > run ( Relation < V > rel ) { fulldatabase = preprocess ( rel ) ; processedIDs = DBIDUtil . newHashSet ( fulldatabase . size ( ) ) ; noiseDim = dimensionality ( fulldatabase ) ; FiniteProgress progress = LOG . isVerbose ( ) ? new FiniteProgress ( "CASH Clustering" , fulldatabase . size ( ) , ...
Run CASH on the relation .
158,077
private Relation < ParameterizationFunction > preprocess ( Relation < V > vrel ) { DBIDs ids = vrel . getDBIDs ( ) ; SimpleTypeInformation < ParameterizationFunction > type = new SimpleTypeInformation < > ( ParameterizationFunction . class ) ; WritableDataStore < ParameterizationFunction > prep = DataStoreUtil . makeSt...
Preprocess the dataset precomputing the parameterization functions .
158,078
private void initHeap ( ObjectHeap < CASHInterval > heap , Relation < ParameterizationFunction > relation , int dim , DBIDs ids ) { CASHIntervalSplit split = new CASHIntervalSplit ( relation , minPts ) ; double [ ] minMax = determineMinMaxDistance ( relation , dim ) ; double d_min = minMax [ 0 ] , d_max = minMax [ 1 ] ...
Initializes the heap with the root intervals .
158,079
private MaterializedRelation < ParameterizationFunction > buildDB ( int dim , double [ ] [ ] basis , DBIDs ids , Relation < ParameterizationFunction > relation ) { ProxyDatabase proxy = new ProxyDatabase ( ids ) ; SimpleTypeInformation < ParameterizationFunction > type = new SimpleTypeInformation < > ( Parameterization...
Builds a dim - 1 dimensional database where the objects are projected into the specified subspace .
158,080
private ParameterizationFunction project ( double [ ] [ ] basis , ParameterizationFunction f ) { double [ ] m = transposeTimes ( basis , f . getColumnVector ( ) ) ; return new ParameterizationFunction ( DoubleVector . wrap ( m ) ) ; }
Projects the specified parameterization function into the subspace described by the given basis .
158,081
private double [ ] [ ] determineBasis ( double [ ] alpha ) { final int dim = alpha . length ; double [ ] nn = new double [ dim + 1 ] ; for ( int i = 0 ; i < nn . length ; i ++ ) { double alpha_i = i == alpha . length ? 0 : alpha [ i ] ; nn [ i ] = ParameterizationFunction . sinusProduct ( 0 , i , alpha ) * FastMath . c...
Determines a basis defining a subspace described by the specified alpha values .
158,082
private CASHInterval determineNextIntervalAtMaxLevel ( ObjectHeap < CASHInterval > heap ) { CASHInterval next = doDetermineNextIntervalAtMaxLevel ( heap ) ; while ( next == null ) { if ( heap . isEmpty ( ) ) { return null ; } next = doDetermineNextIntervalAtMaxLevel ( heap ) ; } return next ; }
Determines the next best interval at maximum level i . e . the next interval containing the most unprocessed objects .
158,083
private CASHInterval doDetermineNextIntervalAtMaxLevel ( ObjectHeap < CASHInterval > heap ) { CASHInterval interval = heap . poll ( ) ; int dim = interval . getDimensionality ( ) ; while ( true ) { if ( interval . getLevel ( ) >= maxLevel && interval . getMaxSplitDimension ( ) == ( dim - 1 ) ) { return interval ; } if ...
Recursive helper method to determine the next best interval at maximum level i . e . the next interval containing the most unprocessed objects
158,084
private double [ ] determineMinMaxDistance ( Relation < ParameterizationFunction > relation , int dimensionality ) { double [ ] min = new double [ dimensionality - 1 ] ; double [ ] max = new double [ dimensionality - 1 ] ; Arrays . fill ( max , Math . PI ) ; HyperBoundingBox box = new HyperBoundingBox ( min , max ) ; d...
Determines the minimum and maximum function value of all parameterization functions stored in the specified database .
158,085
public HistogramResult run ( Database database , Relation < O > relation ) { final DistanceQuery < O > distanceQuery = database . getDistanceQuery ( relation , getDistanceFunction ( ) ) ; final KNNQuery < O > knnQuery = database . getKNNQuery ( distanceQuery , relation . size ( ) ) ; if ( LOG . isVerbose ( ) ) { LOG . ...
Process a database
158,086
public Clustering < M > run ( Database database , Relation < V > relation ) { if ( relation . size ( ) == 0 ) { throw new IllegalArgumentException ( "database empty: must contain elements" ) ; } List < ? extends EMClusterModel < M > > models = mfactory . buildInitialModels ( database , relation , k , SquaredEuclideanDi...
Performs the EM clustering algorithm on the given database .
158,087
public static void recomputeCovarianceMatrices ( Relation < ? extends NumberVector > relation , WritableDataStore < double [ ] > probClusterIGivenX , List < ? extends EMClusterModel < ? > > models , double prior ) { final int k = models . size ( ) ; boolean needsTwoPass = false ; for ( EMClusterModel < ? > m : models )...
Recompute the covariance matrixes .
158,088
public static double assignProbabilitiesToInstances ( Relation < ? extends NumberVector > relation , List < ? extends EMClusterModel < ? > > models , WritableDataStore < double [ ] > probClusterIGivenX ) { final int k = models . size ( ) ; double emSum = 0. ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . ...
Assigns the current probability values to the instances in the database and compute the expectation value of the current mixture of distributions .
158,089
protected synchronized void updateVisualizerMenus ( ) { Projection proj = null ; if ( svgCanvas . getPlot ( ) instanceof DetailView ) { PlotItem item = ( ( DetailView ) svgCanvas . getPlot ( ) ) . getPlotItem ( ) ; proj = item . proj ; } menubar . removeAll ( ) ; menubar . add ( filemenu ) ; ResultHierarchy hier = cont...
Update the visualizer menus .
158,090
public OutlierResult run ( Relation < V > relation ) { final DBIDs ids = relation . getDBIDs ( ) ; ArrayList < ArrayDBIDs > subspaceIndex = buildOneDimIndexes ( relation ) ; Set < HiCSSubspace > subspaces = calculateSubspaces ( relation , subspaceIndex , rnd . getSingleThreadedRandom ( ) ) ; if ( LOG . isVerbose ( ) ) ...
Perform HiCS on a given database .
158,091
private ArrayList < ArrayDBIDs > buildOneDimIndexes ( Relation < ? extends NumberVector > relation ) { final int dim = RelationUtil . dimensionality ( relation ) ; ArrayList < ArrayDBIDs > subspaceIndex = new ArrayList < > ( dim + 1 ) ; SortDBIDsBySingleDimension comp = new VectorUtil . SortDBIDsBySingleDimension ( rel...
Calculates index structures for every attribute i . e . sorts a ModifiableArray of every DBID in the database for every dimension and stores them in a list
158,092
private double [ ] max ( double [ ] distances1 , double [ ] distances2 ) { if ( distances1 . length != distances2 . length ) { throw new RuntimeException ( "different lengths!" ) ; } double [ ] result = new double [ distances1 . length ] ; for ( int i = 0 ; i < distances1 . length ; i ++ ) { result [ i ] = Math . max (...
Returns an array that holds the maximum values of the both specified arrays in each index .
158,093
public static int compileShader ( Class < ? > context , GL2 gl , int type , String name ) throws ShaderCompilationException { int prog = - 1 ; try ( InputStream in = context . getResourceAsStream ( name ) ) { int [ ] error = new int [ 1 ] ; String shaderdata = FileUtil . slurp ( in ) ; prog = gl . glCreateShader ( type...
Compile a shader from a file .
158,094
protected int effectiveBandSize ( final int dim1 , final int dim2 ) { if ( bandSize == Double . POSITIVE_INFINITY ) { return ( dim1 > dim2 ) ? dim1 : dim2 ; } if ( bandSize >= 1. ) { return ( int ) bandSize ; } return ( int ) Math . ceil ( ( dim1 >= dim2 ? dim1 : dim2 ) * bandSize ) ; }
Compute the effective band size .
158,095
public final int addLeafEntry ( E entry ) { if ( ! ( entry instanceof LeafEntry ) ) { throw new UnsupportedOperationException ( "Entry is not a leaf entry!" ) ; } if ( ! isLeaf ( ) ) { throw new UnsupportedOperationException ( "Node is not a leaf node!" ) ; } return addEntry ( entry ) ; }
Adds a new leaf entry to this node s children and returns the index of the entry in this node s children array . An UnsupportedOperationException will be thrown if the entry is not a leaf entry or this node is not a leaf node .
158,096
public final int addDirectoryEntry ( E entry ) { if ( entry instanceof LeafEntry ) { throw new UnsupportedOperationException ( "Entry is not a directory entry!" ) ; } if ( isLeaf ( ) ) { throw new UnsupportedOperationException ( "Node is not a directory node!" ) ; } return addEntry ( entry ) ; }
Adds a new directory entry to this node s children and returns the index of the entry in this node s children array . An UnsupportedOperationException will be thrown if the entry is not a directory entry or this node is not a directory node .
158,097
public boolean deleteEntry ( int index ) { System . arraycopy ( entries , index + 1 , entries , index , numEntries - index - 1 ) ; entries [ -- numEntries ] = null ; return true ; }
Deletes the entry at the specified index and shifts all entries after the index to left .
158,098
@ SuppressWarnings ( "unchecked" ) public final List < E > getEntries ( ) { List < E > result = new ArrayList < > ( numEntries ) ; for ( Entry entry : entries ) { if ( entry != null ) { result . add ( ( E ) entry ) ; } } return result ; }
Returns a list of the entries .
158,099
public void removeMask ( long [ ] mask ) { int dest = BitsUtil . nextSetBit ( mask , 0 ) ; if ( dest < 0 ) { return ; } int src = BitsUtil . nextSetBit ( mask , dest ) ; while ( src < numEntries ) { if ( ! BitsUtil . get ( mask , src ) ) { entries [ dest ] = entries [ src ] ; dest ++ ; } src ++ ; } int rm = src - dest ...
Remove entries according to the given mask .