public class LLSImpute
extends java.lang.Object
Constructor and Description |
---|
LLSImpute()
Default constructor.
|
LLSImpute(java.lang.String fileParam)
Constructor which extract the parameters from a KEEL pattern file and
initializes the InstanceSet structures
|
Modifier and Type | Method and Description |
---|---|
protected void |
config_read(java.lang.String fileParam)
Parse the paramete file in KEEL format to obtain the parameters and working files
|
protected void |
data2string(DenseMatrix mat,
java.lang.String[][] X,
InstanceSet IS)
Parse the DenseMatrix of INPUT real values to a String 2D array, ready for printing
to a file.
|
DenseMatrix |
impute_llsq_l2_blind(DenseMatrix train,
InstanceSet IS)
Function that applies the Local Least Squares Imputation to a given array
|
DenseMatrix |
impute_rowavg(DenseMatrix miss_matrix,
int minexp,
InstanceSet IS)
Perform the row-average of given matrix
|
static DenseMatrix |
inv(DenseMatrix A)
Computes the inverse of a square non-singular Matrix
|
static DenseMatrix |
pinv(DenseMatrix A)
Computes the pseudoinverse of matrix A -> pinv(A) = V * pinv(S) * U'
That is, Moore-Penrose pseudoinverse of a matrix
If A is square and not singular, then pinv(A) is an expensive way to compute inv(A)
|
DenseMatrix |
repmat(DenseMatrix mat,
int m,
int n)
Replicate and tile an array.
|
void |
run()
Function that runs the LLSImpute over the data sets given in the pattern file in
KEEL format
|
void |
similargene(int i,
java.util.ArrayList<java.lang.Integer> missidxj,
java.util.ArrayList<java.lang.Integer> nomissidxj,
int m,
int n,
DenseMatrix miss_matrix,
DenseMatrix E,
java.util.ArrayList<java.lang.Integer> gene_include,
int m_gene_include)
Computes the most similar (nearest) instances to a given one.
|
double |
sum(DenseVector v)
Compute the sum of all members of vector v
|
DenseVector |
sumbyRows(DenseMatrix mat)
From a given matrix mat, it performs the summatory by rows of such matrix
|
protected void |
write_results(java.lang.String output,
java.lang.String[][] X,
InstanceSet IS)
Write data matrix X to disk, in KEEL format
|
public LLSImpute()
public LLSImpute(java.lang.String fileParam)
fileParam
- protected void config_read(java.lang.String fileParam)
fileParam
- Pattern file in KEEL formatpublic void run()
public DenseMatrix impute_llsq_l2_blind(DenseMatrix train, InstanceSet IS)
train
- The Matrix with the dataIS
- The original Instance set, used for reference (attributes, etc.)public void similargene(int i, java.util.ArrayList<java.lang.Integer> missidxj, java.util.ArrayList<java.lang.Integer> nomissidxj, int m, int n, DenseMatrix miss_matrix, DenseMatrix E, java.util.ArrayList<java.lang.Integer> gene_include, int m_gene_include)
i
- The number of the given instance in the E matrix (i.e. the row number)missidxj
- Indices of the missing attributesnomissidxj
- Indices of the non-missing (complete) attributesm
- Rows of the E matrixn
- Columns of the E matrixmiss_matrix
- Original matrix which has no missing value imputed, same size of EE
- Working matrix which has the previous found missing values estimatedgene_include
- The indices of the genes (rows or instances) which we will consider as neighbours to instance im_gene_include
- Number of neighbours to be considered (size of gene_include)public DenseMatrix impute_rowavg(DenseMatrix miss_matrix, int minexp, InstanceSet IS)
miss_matrix
- The original matrix with all missing valuesminexp
- The minimum number of non-missing values to compute the row-averageIS
- The reference InstanceSetpublic static DenseMatrix pinv(DenseMatrix A)
A
- The matrix from we compute the pseudoinversepublic static DenseMatrix inv(DenseMatrix A)
A
- The Matrix from which we will compute the inversepublic double sum(DenseVector v)
v
- The reference vectorpublic DenseVector sumbyRows(DenseMatrix mat)
mat
- The reference matrixpublic DenseMatrix repmat(DenseMatrix mat, int m, int n)
mat
- The original matrixm
- Number of rowwise replicationsn
- Number of columnwise replicationsprotected void data2string(DenseMatrix mat, java.lang.String[][] X, InstanceSet IS)
mat
- The DenseMatrix with the input values in double formatX
- The output String matrix, ready to be printedIS
- The InstanceSet with the original values, used to obtain the OUTPUT valuesprotected void write_results(java.lang.String output, java.lang.String[][] X, InstanceSet IS)
output
- The file to which we printX
- The 2D array with the values of the attributes parsed to a stringIS
- The reference InstanceSet