public MyEvaluation() { m_costMatrix = new weka.classifiers.CostMatrix(2); m_costMatrix.setElement(0, 0, -1); m_costMatrix.setElement(1, 1, -1); m_costMatrix.setElement(0, 1, 1); m_costMatrix.setElement(1, 0, 1); }
public MyEvaluation() { m_costMatrix = new weka.classifiers.CostMatrix(2); m_costMatrix.setElement(0, 0, -1); m_costMatrix.setElement(1, 1, -1); m_costMatrix.setElement(0, 1, 1); m_costMatrix.setElement(1, 0, 1); }
public CostMatrix(int numclasses, double[,] matrix) { Impl = new weka.classifiers.CostMatrix(numclasses); for (int r = 0; r < matrix.GetLength(0); r++) { for (int c = 0; c < matrix.GetLength(1); c++) { Impl.setElement(r, c, matrix[r, c]); } } }
/// <summary> Makes a copy of this ConfusionMatrix after applying the /// supplied CostMatrix to the cells. The resulting ConfusionMatrix /// can be used to get cost-weighted statistics. /// /// </summary> /// <param name="costs">the CostMatrix. /// </param> /// <returns> a ConfusionMatrix that has had costs applied. /// </returns> /// <exception cref="Exception">if the CostMatrix is not of the same size /// as this ConfusionMatrix. /// </exception> public virtual ConfusionMatrix makeWeighted(CostMatrix costs) { if (costs.size() != size()) { throw new System.Exception("Cost and confusion matrices must be the same size"); } ConfusionMatrix weighted = new ConfusionMatrix(m_ClassNames); for (int row = 0; row < size(); row++) { for (int col = 0; col < size(); col++) { weighted.setXmlElement(row, col, getXmlElement(row, col) * costs.getXmlElement(row, col)); } } return weighted; }
public MyEvaluation(weka.classifiers.CostMatrix costMatrix) { m_costMatrix = costMatrix; }
public MyEvaluation(weka.classifiers.CostMatrix costMatrix) { m_costMatrix = costMatrix; }