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

weka.core.MinkowskiDistance 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 .
 */

/*
 *    MinkowskiDistance.java
 *    Copyright (C) 2009-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.core;

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

import weka.core.TechnicalInformation.Field;
import weka.core.TechnicalInformation.Type;
import weka.core.neighboursearch.PerformanceStats;

/**
 *  Implementing Minkowski distance (or similarity)
 * function.
*
* One object defines not one distance but the data model in which the distances * between objects of that data model can be computed.
*
* Attention: For efficiency reasons the use of consistency checks (like are the * data models of the two instances exactly the same), is low.
*
* For more information, see:
*
* Wikipedia. Minkowski distance. URL * http://en.wikipedia.org/wiki/Minkowski_distance. *

* * * BibTeX: * *

 * @misc{missing_id,
 *    author = {Wikipedia},
 *    title = {Minkowski distance},
 *    URL = {http://en.wikipedia.org/wiki/Minkowski_distance}
 * }
 * 
*

* * * Valid options are: *

* *

 * -P <order>
 *  The order 'p'. With '1' being the Manhattan distance and '2'
 *  the Euclidean distance.
 *  (default: 2)
 * 
* *
 * -D
 *  Turns off the normalization of attribute 
 *  values in distance calculation.
 * 
* *
 * -R <col1,col2-col4,...>
 *  Specifies list of columns to used in the calculation of the 
 *  distance. 'first' and 'last' are valid indices.
 *  (default: first-last)
 * 
* *
 * -V
 *  Invert matching sense of column indices.
 * 
* * * * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision: 10203 $ */ public class MinkowskiDistance extends NormalizableDistance implements Cloneable, TechnicalInformationHandler { /** for serialization. */ private static final long serialVersionUID = -7446019339455453893L; /** the order of the minkowski distance. */ protected double m_Order = 2; /** * Constructs an Minkowski Distance object, Instances must be still set. */ public MinkowskiDistance() { super(); } /** * Constructs an Minkowski Distance object and automatically initializes the * ranges. * * @param data the instances the distance function should work on */ public MinkowskiDistance(Instances data) { super(data); } /** * Returns a string describing this object. * * @return a description of the evaluator suitable for displaying in the * explorer/experimenter gui */ @Override public String globalInfo() { return "Implementing Minkowski distance (or similarity) function.\n\n" + "One object defines not one distance but the data model in which " + "the distances between objects of that data model can be computed.\n\n" + "Attention: For efficiency reasons the use of consistency checks " + "(like are the data models of the two instances exactly the same), " + "is low.\n\n" + "For more information, see:\n\n" + getTechnicalInformation().toString(); } /** * Returns an instance of a TechnicalInformation object, containing detailed * information about the technical background of this class, e.g., paper * reference or book this class is based on. * * @return the technical information about this class */ @Override public TechnicalInformation getTechnicalInformation() { TechnicalInformation result; result = new TechnicalInformation(Type.MISC); result.setValue(Field.AUTHOR, "Wikipedia"); result.setValue(Field.TITLE, "Minkowski distance"); result.setValue(Field.URL, "http://en.wikipedia.org/wiki/Minkowski_distance"); return result; } /** * 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