001package javax.visrec.ml.data; 002 003import javax.visrec.ml.data.norm.Normalizer; 004 005/** 006 * Utility class that provides commmon operations on data sets 007 * @author zoran 008 */ 009public class DataSets { 010 011 private DataSets() { } 012 013 // scale values 014 // maybe just provide DataSet.normalize(new MaxNormalizer) , and dataSet injects itself into normalizer 015 // or even better norm= new MaxNormalizer(dataSet); norm.normalize(); also separate construction from analysis 016 017 public static <E> DataSet<E> normalize(DataSet<E> dataSet, Normalizer norm) { 018 return norm.normalize(dataSet, false); 019 } 020 021 // how about moving thes estatic methods to coresponding interface? 022// public static <E> DataSet<E> normalizeMax(DataSet<E> dataSet) { 023// Normalizer norm = new MaxNormalizer(dataSet); // perform analysys of data set (find max values) 024// return norm.normalize(dataSet, false); // perfrom normalization and return as new data set 025// } 026 027// public static <E> DataSet<E> normalizeMinMax(DataSet<E> dataSet) { 028// Normalizer norm = new MinMaxNormalizer(dataSet); // perform analysys of data set (find max values) 029// return norm.normalize(dataSet, false); // perfrom normalization and return as new data set 030// } 031 032// public static <E> DataSet<E> normalizeRange(DataSet<E> dataSet, float low, float high) { 033// Normalizer norm = new MinMaxNormalizer(dataSet); // perform analysys of data set (find max values) 034// return norm.normalize(dataSet, false); // perfrom normalization and return as new data set 035// } 036 037 038 // how to specify which columns to normalize? do we need to? just normalize all 039 // how will this method know about how to normalize specific type of elemeents? eg. User? or this assumes only numeric values 040 041 042 // retrun data set whith ddesired statistical properties 043 // zero mean, one std 044 public static <E> DataSet<E> standardize(DataSet<E> dataSet) { // apply to all numer columns 045 // how will this method know about how to normalize specific type of elemeents? 046 throw new UnsupportedOperationException("not implemented"); 047 } 048 049 // this shoul ddefinitely be utility method 050 public static <E> DataSet<E> removeDuplicates() { 051 throw new UnsupportedOperationException("not implemented"); 052 } 053 054 //transform() - maybe can transorm into datas set whsle elements ar eof another type 055 056// statisticsSummary () - mean std freq by cols, maybe better go put it in dat aset class? 057 // max, min, mean, std 058 // returns true if data set is balanced (only needed for classification problems, not to go in Dataset interface) 059 public static boolean isBalanced(DataSet<?> dataSet) { //use generic method to infer type of data set elements 060 throw new UnsupportedOperationException("not implemented"); 061 } 062 063 // summary - return basic statistics for each column in dat aset min, max, mean , mode, std, 1q, 3q 064 065 /** 066 addNoise with some noice generator 067 balance(BalanceStrtegy) 068 069 dimensionalityreuction 070 */ 071 072}