Package com.polytechnik.utils
Class RadonNikodymSpectralModel
java.lang.Object
com.polytechnik.utils.RadonNikodymSpectralModel
- All Implemented Interfaces:
AttributesProductsMultiIndexed
,FtoChristoffelFunctionTransformable
,RNPointEvaluatable
public class RadonNikodymSpectralModel
extends Object
implements AttributesProductsMultiIndexed, RNPointEvaluatable, FtoChristoffelFunctionTransformable
Radon-Nikodym Spectral Model
https://arxiv.org/abs/1906.00460.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
One point output.Nested classes/interfaces inherited from interface com.polytechnik.utils.AttributesProductsMultiIndexed
AttributesProductsMultiIndexed.BasisFunction1D, AttributesProductsMultiIndexed.MIScanner
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final Function
<double[], double[]> (package private) static double
No "final", a kludgy way to make a test fromTestRN
.(package private) final double[]
final double[]
Lebesgue quadrature.final int
final int
final double[]
Lebesgue quadrature.final double[]
Lebesgue quadrature.final double[]
Input matrix.final double[]
Input matrix. -
Constructor Summary
ConstructorsConstructorDescriptionRadonNikodymSpectralModel
(int noriginal, int nX, double[] XfX, double[] XX, double[] ev, Function<double[], double[]> convertxFromOriginalToX, ToDoubleFunction<double[]> takeAverageOfFunctionInBasisX) Construct the model from <X|X> and <X|f|X> matrices. -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]
getAllXorigProjectedToPsik
(DataReadObservationVectorXF orig_sample) Expansion coefficients of the original attributes in psik.getAttribsProductsMultiIndexed
(int d, DataReadObservationVectorXF orig_sample) Create attributes products of a multi--index not greater than d.(package private) XXMatrs
Calculate Christoffel function from original sample.double[]
getChristoffelWeights
(DataReadObservationVectorXF orig_sample) (package private) double[]
getPsikAtXorig
(double[] xorig) Used internally.Replace XfX by Christoffel function operator.getRadonNikodymSpectralModelWithFassumedDiagonalInChristoffelFunctionBasis
(DataReadObservationVectorXF orig_sample) Convert XfX to Christoffel function operator bases, take only diagonal elements, then convert back.getRNatXoriginal
(double[] xorig) An evaluation of Radon-Nikodym derivative.reduceBasisSize
(int D) Reduce the number of basis functions X performing optimal clustering.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.polytechnik.utils.RNPointEvaluatable
evaluateRNatSequence
-
Field Details
-
nX
public final int nX -
noriginal
public final int noriginal -
XX
public final double[] XXInput matrix. -
XfX
public final double[] XfXInput matrix. -
f
public final double[] fLebesgue quadrature. See https://arxiv.org/abs/1906.00460. -
w
public final double[] wLebesgue quadrature. See https://arxiv.org/abs/1906.00460. -
psiaverage
public final double[] psiaverageLebesgue quadrature. See https://arxiv.org/abs/1906.00460. -
convertxFromOriginalToX
-
ev
final double[] ev -
EPS_selftest
static double EPS_selftestNo "final", a kludgy way to make a test fromTestRN
. An alternative can be constructor's argument, a factory, or an injection.
-
-
Constructor Details
-
RadonNikodymSpectralModel
public RadonNikodymSpectralModel(int noriginal, int nX, double[] XfX, double[] XX, double[] ev, Function<double[], double[]> convertxFromOriginalToX, ToDoubleFunction<double[]> takeAverageOfFunctionInBasisX) Construct the model from <X|X> and <X|f|X> matrices. Typically not used directly, seegetDataRegularized_EV()
andgetDataRegularized_LIN()
methods that obtain the data ofRegularizedVectorXF
type.
-
-
Method Details
-
getPsikAtXorig
double[] getPsikAtXorig(double[] xorig) Used internally. For public exposure use getRNatXoriginal(xorig).getPsikAtX(). -
getRNatXoriginal
Description copied from interface:RNPointEvaluatable
An evaluation of Radon-Nikodym derivative.- Specified by:
getRNatXoriginal
in interfaceRNPointEvaluatable
-
getAllXorigProjectedToPsik
Expansion coefficients of the original attributes in psik.- Returns:
- The matrix[j][k]=<xorig[j]*psi[k]>.
-
getChristoffelFunctionDensityMatrixInEvBasis
Calculate Christoffel function from original sample. The result is in |psi> basis. -
getChristoffelWeights
-
getRadonNikodymSpectralModelWithChristoffelFunctionAsF
public RadonNikodymSpectralModel getRadonNikodymSpectralModelWithChristoffelFunctionAsF(DataReadObservationVectorXF orig_sample) Replace XfX by Christoffel function operator.- Specified by:
getRadonNikodymSpectralModelWithChristoffelFunctionAsF
in interfaceFtoChristoffelFunctionTransformable
- Parameters:
orig_sample
- Original sample the model is built from.- Returns:
- A model with Christoffel function operator as f.
-
getRadonNikodymSpectralModelWithFassumedDiagonalInChristoffelFunctionBasis
public RadonNikodymSpectralModel getRadonNikodymSpectralModelWithFassumedDiagonalInChristoffelFunctionBasis(DataReadObservationVectorXF orig_sample) Convert XfX to Christoffel function operator bases, take only diagonal elements, then convert back.- Specified by:
getRadonNikodymSpectralModelWithFassumedDiagonalInChristoffelFunctionBasis
in interfaceFtoChristoffelFunctionTransformable
- Parameters:
orig_sample
- Original sample the model is built from.- Returns:
- A model with adjusted f to be diagonal in Christoffel function operator basis.
-
reduceBasisSize
Reduce the number of basis functions X performing optimal clustering. A D-point Gaussian quadrature is built first (with f[i] nodes and w[i] weights, i=0..nX-1), then the obtained eigenfuctions are converted from f to X basis, and new RadonNikodymSpectralModel is created.- Parameters:
D
- Clusters number.- Returns:
- Optimal model of D clusters.
-
getAttribsProductsMultiIndexed
public DataReadObservationVectorXF getAttribsProductsMultiIndexed(int d, DataReadObservationVectorXF orig_sample) Create attributes products of a multi--index not greater than d. The method products the eigenfunctions, not the original basis.- Specified by:
getAttribsProductsMultiIndexed
in interfaceAttributesProductsMultiIndexed
- Parameters:
d
- The degree.orig_sample
- Original data.- Returns:
- producted
DataReadObservationVectorXF
.
-