Functions to construct distance curves used for class prior estimation

makeCurvesFromDistanceMatrix[source]

makeCurvesFromDistanceMatrix(dist_matrix, curves, mixtureInstanceRemaining)

Construct multiple distance curves, using the precomputed distances

Arguments:

- dist_matrix : float[num_component_instances, num_mixture_instances]
    dist_matrix[i,j] contains the distance between component instance i and mixture instance j

- curves : float[num_curves_to_average, num_mixture_instances]
    matrix to fill with distance curves (passed initialized matrix because jit
    in no python mode can't create matrices)

- mixtureInstanceRemaining : boolean[num_curves_to_average, num_mixture_instances]
    boolean matrix indicating whether the given mixture instance should be
    considered when constructing the curve at that iteration.
    At each iteration, the mixture point that is closest to the sampled component
    instance is removed from consideration in subsequent iterations.
    Pass matrix initialized to all True in order for all mixture instances to be
    considered in curve construction.

makeCurve[source]

makeCurve()

Construct the distance curve used to estimate the class prior of the distribution from which the mixture instances were sampled

Arguments:

- compInstances : float[num_component_instances, dim]
    instances sampled from the component distribution

- mixInstances : float[num_mixture_instances, dim] in range[0,1]
    instances sampled from the mixture distribution

- metric : string or callable
    only used if gpu==False
    see scipy.spatial.distance.cdist for details

- num_curves_to_average : int : default 25
    repeat the curve construction process this number of times, averaging over all curves

- quantiles : float[n_quantiles] : default np.arange(0,1,.01)
    after averaging over all curves, use these quantiles of the averaged curve
    as the final distance curve
curve.shape
(100,)

plotCurve[source]

plotCurve(curve)

Plot the given distance curve

curve2 = makeCurve(posInstances, mixInstances, gpu=False)
plotCurve(curve2)