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

weka.classifiers.mi.MILR Maven / Gradle / Ivy

Go to download

A collection of multi-instance learning classifiers. Includes the Citation KNN method, several variants of the diverse density method, support vector machines for multi-instance learning, simple wrappers for applying standard propositional learners to multi-instance data, decision tree and rule learners, and some other methods.

The 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 .
 */

/*
 * MILR.java
 * Copyright (C) 2005 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.classifiers.mi;

import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;

import weka.classifiers.AbstractClassifier;
import weka.core.Capabilities;
import weka.core.Capabilities.Capability;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.MultiInstanceCapabilitiesHandler;
import weka.core.Optimization;
import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionUtils;
import weka.core.SelectedTag;
import weka.core.Tag;
import weka.core.Utils;

/**
 *  Uses either standard or collective multi-instance
 * assumption, but within linear regression. For the collective assumption, it
 * offers arithmetic or geometric mean for the posteriors.
 * 

* * * Valid options are: *

* *

 * -D
 *  Turn on debugging output.
 * 
* *
 * -R <ridge>
 *  Set the ridge in the log-likelihood.
 * 
* *
 * -A [0|1|2]
 *  Defines the type of algorithm:
 *   0. standard MI assumption
 *   1. collective MI assumption, arithmetic mean for posteriors
 *   2. collective MI assumption, geometric mean for posteriors
 * 
* * * * @author Eibe Frank ([email protected]) * @author Xin Xu ([email protected]) * @version $Revision: 10369 $ */ public class MILR extends AbstractClassifier implements OptionHandler, MultiInstanceCapabilitiesHandler { /** for serialization */ static final long serialVersionUID = 1996101190172373826L; protected double[] m_Par; /** The number of the class labels */ protected int m_NumClasses; /** The ridge parameter. */ protected double m_Ridge = 1e-6; /** Class labels for each bag */ protected int[] m_Classes; /** MI data */ protected double[][][] m_Data; /** All attribute names */ protected Instances m_Attributes; protected double[] xMean = null, xSD = null; /** the type of processing */ protected int m_AlgorithmType = ALGORITHMTYPE_DEFAULT; /** standard MI assumption */ public static final int ALGORITHMTYPE_DEFAULT = 0; /** collective MI assumption, arithmetic mean for posteriors */ public static final int ALGORITHMTYPE_ARITHMETIC = 1; /** collective MI assumption, geometric mean for posteriors */ public static final int ALGORITHMTYPE_GEOMETRIC = 2; /** the types of algorithms */ public static final Tag[] TAGS_ALGORITHMTYPE = { new Tag(ALGORITHMTYPE_DEFAULT, "standard MI assumption"), new Tag(ALGORITHMTYPE_ARITHMETIC, "collective MI assumption, arithmetic mean for posteriors"), new Tag(ALGORITHMTYPE_GEOMETRIC, "collective MI assumption, geometric mean for posteriors"), }; /** * Returns the tip text for this property * * @return tip text for this property suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "Uses either standard or collective multi-instance assumption, but " + "within linear regression. For the collective assumption, it offers " + "arithmetic or geometric mean for the posteriors."; } /** * 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