All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.classifiers.functions.supportVector.PrecomputedKernelMatrixKernel Maven / Gradle / Ivy

Go to download

The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This version represents the developer version, the "bleeding edge" of development, you could say. New functionality gets added to this version.

There is a newer version: 3.9.6
Show newest version
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see .
 */

/*
 *    PrecomputedKernelMatrixKernel.java
 *    Copyright (C) 2008-2012 University of Waikato, Hamilton, New Zealand
 *
 */
package weka.classifiers.functions.supportVector;

import java.io.File;
import java.io.FileReader;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;

import weka.core.Capabilities;
import weka.core.Capabilities.Capability;
import weka.core.Copyable;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.RevisionUtils;
import weka.core.Utils;
import weka.core.matrix.Matrix;

/**
 * 
  This kernel is based on a static kernel matrix that
 * is read from a file. Instances must have a single nominal attribute
 * (excluding the class). This attribute must be the first attribute in the file
 * and its values are used to reference rows/columns in the kernel matrix. The
 * second attribute must be the class attribute.
 * 

* * * Valid options are: *

* *

 * -D
 *  Enables debugging output (if available) to be printed.
 *  (default: off)
 * 
* *
 * -M <file name>
 *  The file name of the file that holds the kernel matrix.
 *  (default: kernelMatrix.matrix)
 * 
* * * * @author Eibe Frank ([email protected]) * @version $Revision: 14512 $ */ public class PrecomputedKernelMatrixKernel extends Kernel implements Copyable { /** for serialization */ static final long serialVersionUID = -321831645846363333L; /** The file holding the kernel matrix. */ protected File m_KernelMatrixFile = new File("kernelMatrix.matrix"); /** The kernel matrix. */ protected Matrix m_KernelMatrix; /** A classifier counter. */ protected int m_Counter; /** * Return a shallow copy of this kernel * * @return a shallow copy of this kernel */ @Override public Object copy() { PrecomputedKernelMatrixKernel newK = new PrecomputedKernelMatrixKernel(); newK.setKernelMatrix(m_KernelMatrix); newK.setKernelMatrixFile(m_KernelMatrixFile); newK.m_Counter = m_Counter; return newK; } /** * Returns a string describing the kernel * * @return a description suitable for displaying in the explorer/experimenter * gui */ @Override public String globalInfo() { return "This kernel is based on a static kernel matrix that is read from a file. " + "Instances must have a single nominal attribute (excluding the class). " + "This attribute must be the first attribute in the file and its values are " + "used to reference rows/columns in the kernel matrix. The second attribute " + "must be the class attribute."; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy