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

weka.filters.unsupervised.attribute.NumericToDate 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.

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

/*
 * DateToNumeric.java
 * Copyright (C) 2006-2017 University of Waikato, Hamilton, New Zealand
 */

package weka.filters.unsupervised.attribute;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;

import weka.core.*;
import weka.core.Capabilities.Capability;
import weka.filters.SimpleBatchFilter;

/**
 * 
 * A filter for turning numeric attributes into date attributes.
 * The numeric value is assumed to be the number of milliseconds since January 1, 1970, 00:00:00 GMT,
 * corresponding to the given date."
 * 

* * * * Valid options are: *

* *

 * -R <col1,col2-col4,...>
 *  Specifies list of attributes to turn into date ones. Only numeric attributes will be converted.
 *  First and last are valid indexes.
 *  (default: first-last)
 * 
* *
 * -V
 *  Invert matching sense of column indexes.
 * 
* *
 * -F <value index>
 *  Sets the output date format string (default corresponds to ISO-8601).
 * 
* * * * @author eibe (eibe at waikato dot ac dot nz) * @version $Revision: 14274 $ */ public class NumericToDate extends SimpleBatchFilter implements WeightedAttributesHandler, WeightedInstancesHandler { /** for serialization */ private static final long serialVersionUID = -6514657821295776239L; /** Stores which columns to turn into date attributes */ protected Range m_Cols = new Range("first-last"); /** The default columns to turn into date attributes */ protected String m_DefaultCols = "first-last"; /** The default output date format. Corresponds to ISO-8601 format. */ protected static final SimpleDateFormat DEFAULT_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); /** The output date format. */ protected SimpleDateFormat m_DateFormat = DEFAULT_FORMAT; /** * Returns a string describing this filter * * @return a description of the filter suitable for displaying in the * explorer/experimenter gui */ @Override public String globalInfo() { return "A filter for turning numeric attributes into date attributes." + "The numeric value is assumed to be the number of milliseconds since January 1, 1970, 00:00:00 GMT, " + "corresponding to the given date."; } /** * Gets an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy