zhao.algorithmMagic.operands.matrix.NumberMatrix Maven / Gradle / Ivy
package zhao.algorithmMagic.operands.matrix;
import zhao.algorithmMagic.operands.vector.Vector;
/**
* 数值矩阵,其中的每一个元素都应是一个数值类型的对象,数值矩阵支持维度选择等函数。
*
* Numeric matrix, in which each element should be an object of numerical type. Numeric matrix supports functions such as dimension selection.
*
* @author zhao
*/
public abstract class NumberMatrix, ElementType extends Number, ArrayType, ArraysType>
extends
Matrix {
/**
* 构造一个空的矩阵,指定其矩阵的行列数
*
* Constructs an empty matrix, specifying the number of rows and columns of its matrix
*
* @param rowCount 矩阵中的行数量
*
* the number of rows in the matrix
* @param colCount 矩阵中的列数量
*
* @param arraysType 该矩阵对象中的二维数组对象。
*/
protected NumberMatrix(int rowCount, int colCount, ArraysType arraysType) {
super(rowCount, colCount, arraysType);
}
/**
* @return 矩阵中包含的维度数量,这里是矩阵的行列之积
*
* the number of dimensions contained in the vector
*/
@Override
public final int getNumberOfDimensions() {
return getRowCount() * getColCount();
}
/**
* 将两个操作数进行求和的方法,具体用法请参阅API说明。
*
* The method for summing two operands, please refer to the API description for specific usage.
*
* @param value 被求和的参数 Parameters to be summed
* @return 求和之后的数值 the value after the sum
*
* There is no description for the super interface, please refer to the subclass documentation
*/
public abstract ImplementationType add(Vector, ?, ?> value);
/**
* 在两个操作数之间做差的方法,具体用法请参阅API说明。
*
* The method of making a difference between two operands, please refer to the API description for specific usage.
*
* @param value 被做差的参数(被减数) The parameter to be subtracted (minuend)
* @return 差异数值 difference value
* There is no description for the super interface, please refer to the subclass documentation
*/
public abstract ImplementationType diff(Vector, ?, ?> value);
/**
* 去除冗余特征维度,将当前矩阵中的每一个维度都进行方差或无向差计算,并将过于稳定的冗余特征去除。
*
* Remove redundant feature dimensions, calculate variance or undirected difference of each dimension in the current matrix, and remove redundant features that are too stable.
*
* @param threshold 去除阈值,代表去除的维度数量是当前所有维度数量的百分之threshold,小于0.01将认为不进行去除
*
* Removal threshold, which means that the number of dimensions removed is the threshold of the current number of all dimensions. If it is less than 0.01, it will be considered not to be removed
* @return 去除冗余特征维度之后的新矩阵
*
* New matrix after removing redundant feature dimensions
*/
public abstract ImplementationType featureSelection(double threshold);
/**
* 删除与目标索引维度相关的所有行维度,并返回新矩阵对象。
*
* Delete all row dimensions related to the target index dimension and return a new matrix object.
*
* @param index 需要被作为相关系数中心点的行编号。
*
* The row number to be used as the center point of the correlation coefficient.
* @param thresholdLeft 相关系数阈值,需要被删除的相关系数阈值区间左边界。
*
* The correlation coefficient threshold is the left boundary of the correlation coefficient threshold interval to be deleted.
* @param thresholdRight 相关系数阈值,需要被删除的相关系数阈值区间右边界。
*
* The correlation coefficient threshold is the right boundary of the correlation coefficient threshold interval to be deleted.
* @return 进行了相关维度删除之后构造出来的新矩阵
*
* The new matrix constructed after deleting relevant dimensions
*/
public abstract ImplementationType deleteRelatedDimensions(int index, double thresholdLeft, double thresholdRight);
/**
* 提取出子矩阵对象
*
* @param x1 被提取矩阵在原矩阵中的起始坐标点。
*
* The starting coordinate point of the extracted matrix in the original matrix.
* @param y1 被提取矩阵在原矩阵中的起始坐标点。
*
* The starting coordinate point of the extracted matrix in the original matrix.
* @param x2 被提取矩阵在原矩阵中的终止坐标点。
*
* The end coordinate point of the extracted matrix in the original matrix.
* @param y2 被提取矩阵在原矩阵中的终止坐标点。
*
* The end coordinate point of the extracted matrix in the original matrix.
* @return 整形矩阵对象中的子矩阵对象。
*/
public abstract ImplementationType extractMat(int x1, int y1, int x2, int y2);
/**
* 提取出子矩阵对象
*
* @param y1 被提取矩阵在原矩阵中的起始坐标点。
*
* The starting coordinate point of the extracted matrix in the original matrix.
* @param y2 被提取矩阵在原矩阵中的终止坐标点。
*
* The end coordinate point of the extracted matrix in the original matrix.
* @return 整形矩阵对象中的子矩阵对象。
*/
public abstract ImplementationType extractSrcMat(int y1, int y2);
}