Fixed indentation.
This commit is contained in:
parent
2945f082bb
commit
db70ee980f
16 changed files with 469 additions and 469 deletions
|
@ -16,7 +16,7 @@
|
|||
"Creates the right parameters for a weka object. Returns a clojure vector."
|
||||
(fn [kind map] kind))
|
||||
|
||||
;TODO: consider passing in the make-filter-options body here as well in additon to the docstring.
|
||||
;TODO: consider passing in the make-filter-options body here as well in additon to the docstring.
|
||||
#_(defmacro defsearch
|
||||
"Defines the filter's fn that creates a fn to make and apply the filter."
|
||||
[filter-name]
|
||||
|
@ -29,27 +29,27 @@
|
|||
(make-apply-filter ~filter-keyword attributes# ds#))))))
|
||||
|
||||
(defmethod make-obj-options :greedy
|
||||
;; -C
|
||||
;; Use conservative forward search
|
||||
;;
|
||||
;; -B
|
||||
;; Use a backward search instead of a
|
||||
;; forward one.
|
||||
;;
|
||||
;; -P <start set>
|
||||
;; Specify a starting set of attributes.
|
||||
;; Eg. 1,3,5-7.
|
||||
;;
|
||||
;; -R
|
||||
;; Produce a ranked list of attributes.
|
||||
;;
|
||||
;; -T <threshold>
|
||||
;; Specify a theshold by which attributes
|
||||
;; may be discarded from the ranking.
|
||||
;; Use in conjuction with -R
|
||||
;;
|
||||
;; -N <num to select>
|
||||
;; Specify number of attributes to select
|
||||
;; -C
|
||||
;; Use conservative forward search
|
||||
;;
|
||||
;; -B
|
||||
;; Use a backward search instead of a
|
||||
;; forward one.
|
||||
;;
|
||||
;; -P <start set>
|
||||
;; Specify a starting set of attributes.
|
||||
;; Eg. 1,3,5-7.
|
||||
;;
|
||||
;; -R
|
||||
;; Produce a ranked list of attributes.
|
||||
;;
|
||||
;; -T <threshold>
|
||||
;; Specify a theshold by which attributes
|
||||
;; may be discarded from the ranking.
|
||||
;; Use in conjuction with -R
|
||||
;;
|
||||
;; -N <num to select>
|
||||
;; Specify number of attributes to select
|
||||
|
||||
([kind m]
|
||||
(let [weka-opts (->> (extract-attributes "-P" :starting-attributes)
|
||||
|
@ -76,45 +76,45 @@
|
|||
;; -C :direction ...)
|
||||
|
||||
(defmethod make-obj-options :linear-forward
|
||||
;; LinearForwardSelection:
|
||||
;;
|
||||
;; Extension of BestFirst. Takes a restricted number of k attributes into account. Fixed-set selects a fixed number k of attributes, whereas k is increased in each step when fixed-width is selected. The search uses either the initial ordering to select the top k attributes, or performs a ranking (with the same evalutator the search uses later on). The search direction can be forward, or floating forward selection (with opitional backward search steps).
|
||||
;;
|
||||
;; For more information see:
|
||||
;;
|
||||
;; Martin Guetlein (2006). Large Scale Attribute Selection Using Wrappers. Freiburg, Germany.
|
||||
;;
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -P <start set>
|
||||
;; Specify a starting set of attributes.
|
||||
;; Eg. 1,3,5-7.
|
||||
;;
|
||||
;; -D <0 = forward selection | 1 = floating forward selection>
|
||||
;; Forward selection method. (default = 0).
|
||||
;;
|
||||
;; -N <num>
|
||||
;; Number of non-improving nodes to
|
||||
;; consider before terminating search.
|
||||
;;
|
||||
;; -I
|
||||
;; Perform initial ranking to select the
|
||||
;; top-ranked attributes.
|
||||
;;
|
||||
;; -K <num>
|
||||
;; Number of top-ranked attributes that are
|
||||
;; taken into account by the search.
|
||||
;;
|
||||
;; -T <0 = fixed-set | 1 = fixed-width>
|
||||
;; Type of Linear Forward Selection (default = 0).
|
||||
;;
|
||||
;; -S <num>
|
||||
;; Size of lookup cache for evaluated subsets.
|
||||
;; Expressed as a multiple of the number of
|
||||
;; attributes in the data set. (default = 1)
|
||||
;;
|
||||
;; -Z
|
||||
;; verbose on/off
|
||||
;; LinearForwardSelection:
|
||||
;;
|
||||
;; Extension of BestFirst. Takes a restricted number of k attributes into account. Fixed-set selects a fixed number k of attributes, whereas k is increased in each step when fixed-width is selected. The search uses either the initial ordering to select the top k attributes, or performs a ranking (with the same evalutator the search uses later on). The search direction can be forward, or floating forward selection (with opitional backward search steps).
|
||||
;;
|
||||
;; For more information see:
|
||||
;;
|
||||
;; Martin Guetlein (2006). Large Scale Attribute Selection Using Wrappers. Freiburg, Germany.
|
||||
;;
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -P <start set>
|
||||
;; Specify a starting set of attributes.
|
||||
;; Eg. 1,3,5-7.
|
||||
;;
|
||||
;; -D <0 = forward selection | 1 = floating forward selection>
|
||||
;; Forward selection method. (default = 0).
|
||||
;;
|
||||
;; -N <num>
|
||||
;; Number of non-improving nodes to
|
||||
;; consider before terminating search.
|
||||
;;
|
||||
;; -I
|
||||
;; Perform initial ranking to select the
|
||||
;; top-ranked attributes.
|
||||
;;
|
||||
;; -K <num>
|
||||
;; Number of top-ranked attributes that are
|
||||
;; taken into account by the search.
|
||||
;;
|
||||
;; -T <0 = fixed-set | 1 = fixed-width>
|
||||
;; Type of Linear Forward Selection (default = 0).
|
||||
;;
|
||||
;; -S <num>
|
||||
;; Size of lookup cache for evaluated subsets.
|
||||
;; Expressed as a multiple of the number of
|
||||
;; attributes in the data set. (default = 1)
|
||||
;;
|
||||
;; -Z
|
||||
;; verbose on/off
|
||||
([kind m]
|
||||
(let [weka-opts (->>
|
||||
(extract-attributes "-P" :starting-attributes)
|
||||
|
@ -167,58 +167,58 @@
|
|||
"1")))))
|
||||
|
||||
(defmethod make-obj-options :genetic
|
||||
;; GeneticSearch:
|
||||
;;
|
||||
;; Performs a search using the simple genetic algorithm described in Goldberg (1989).
|
||||
;;
|
||||
;; For more information see:
|
||||
;;
|
||||
;; David E. Goldberg (1989). Genetic algorithms in search, optimization and machine learning. Addison-Wesley.
|
||||
;;
|
||||
;; BibTeX:
|
||||
;;
|
||||
;; @book{Goldberg1989,
|
||||
;; author = {David E. Goldberg},
|
||||
;; publisher = {Addison-Wesley},
|
||||
;; title = {Genetic algorithms in search, optimization and machine learning},
|
||||
;; year = {1989},
|
||||
;; ISBN = {0201157675}
|
||||
;; }
|
||||
;;
|
||||
;;
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -P <start set>
|
||||
;; Specify a starting set of attributes.
|
||||
;; Eg. 1,3,5-7.If supplied, the starting set becomes
|
||||
;; one member of the initial random
|
||||
;; population.
|
||||
;;
|
||||
;; -Z <population size>
|
||||
;; Set the size of the population (even number).
|
||||
;; (default = 20).
|
||||
;;
|
||||
;; -G <number of generations>
|
||||
;; Set the number of generations.
|
||||
;; (default = 20)
|
||||
;;
|
||||
;; -C <probability of crossover>
|
||||
;; Set the probability of crossover.
|
||||
;; (default = 0.6)
|
||||
;;
|
||||
;; -M <probability of mutation>
|
||||
;; Set the probability of mutation.
|
||||
;; (default = 0.033)
|
||||
;;
|
||||
;; -R <report frequency>
|
||||
;; Set frequency of generation reports.
|
||||
;; e.g, setting the value to 5 will
|
||||
;; report every 5th generation
|
||||
;; (default = number of generations)
|
||||
;;
|
||||
;; -S <seed>
|
||||
;; Set the random number seed.
|
||||
;; (default = 1)
|
||||
;; GeneticSearch:
|
||||
;;
|
||||
;; Performs a search using the simple genetic algorithm described in Goldberg (1989).
|
||||
;;
|
||||
;; For more information see:
|
||||
;;
|
||||
;; David E. Goldberg (1989). Genetic algorithms in search, optimization and machine learning. Addison-Wesley.
|
||||
;;
|
||||
;; BibTeX:
|
||||
;;
|
||||
;; @book{Goldberg1989,
|
||||
;; author = {David E. Goldberg},
|
||||
;; publisher = {Addison-Wesley},
|
||||
;; title = {Genetic algorithms in search, optimization and machine learning},
|
||||
;; year = {1989},
|
||||
;; ISBN = {0201157675}
|
||||
;; }
|
||||
;;
|
||||
;;
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -P <start set>
|
||||
;; Specify a starting set of attributes.
|
||||
;; Eg. 1,3,5-7.If supplied, the starting set becomes
|
||||
;; one member of the initial random
|
||||
;; population.
|
||||
;;
|
||||
;; -Z <population size>
|
||||
;; Set the size of the population (even number).
|
||||
;; (default = 20).
|
||||
;;
|
||||
;; -G <number of generations>
|
||||
;; Set the number of generations.
|
||||
;; (default = 20)
|
||||
;;
|
||||
;; -C <probability of crossover>
|
||||
;; Set the probability of crossover.
|
||||
;; (default = 0.6)
|
||||
;;
|
||||
;; -M <probability of mutation>
|
||||
;; Set the probability of mutation.
|
||||
;; (default = 0.033)
|
||||
;;
|
||||
;; -R <report frequency>
|
||||
;; Set frequency of generation reports.
|
||||
;; e.g, setting the value to 5 will
|
||||
;; report every 5th generation
|
||||
;; (default = number of generations)
|
||||
;;
|
||||
;; -S <seed>
|
||||
;; Set the random number seed.
|
||||
;; (default = 1)
|
||||
([kind m]
|
||||
(->> (extract-attributes "-P" :starting-attributes)
|
||||
(check-option-values m
|
||||
|
@ -264,31 +264,31 @@
|
|||
:ignore-locally-predictive-attrs "-L"})))
|
||||
|
||||
(defn attribute-eval-options [m]
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -M
|
||||
;; treat missing values as a seperate value.
|
||||
;;
|
||||
;; -B
|
||||
;; just binarize numeric attributes instead
|
||||
;; of properly discretizing them.
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -M
|
||||
;; treat missing values as a seperate value.
|
||||
;;
|
||||
;; -B
|
||||
;; just binarize numeric attributes instead
|
||||
;; of properly discretizing them.
|
||||
(check-options m
|
||||
{:treat-missing-vals-separate "-M"
|
||||
:binarize-numeric-attrs "-B"}))
|
||||
|
||||
(defmethod make-obj-options :info-gain
|
||||
;; InfoGainAttributeEval :
|
||||
;;
|
||||
;; Evaluates the worth of an attribute by measuring the information gain with respect to the class.
|
||||
;;
|
||||
;; InfoGain(Class,Attribute) = H(Class) - H(Class | Attribute).
|
||||
;; InfoGainAttributeEval :
|
||||
;;
|
||||
;; Evaluates the worth of an attribute by measuring the information gain with respect to the class.
|
||||
;;
|
||||
;; InfoGain(Class,Attribute) = H(Class) - H(Class | Attribute).
|
||||
([kind m]
|
||||
(attribute-eval-options m)))
|
||||
|
||||
(defmethod make-obj-options :chi-squared
|
||||
;; ChiSquaredAttributeEval :
|
||||
;;
|
||||
;; Evaluates the worth of an attribute by computing the value of the chi-squared statistic with respect to the class.
|
||||
;; ChiSquaredAttributeEval :
|
||||
;;
|
||||
;; Evaluates the worth of an attribute by computing the value of the chi-squared statistic with respect to the class.
|
||||
([kind m]
|
||||
(attribute-eval-options m)))
|
||||
|
||||
|
@ -353,24 +353,24 @@
|
|||
:weight-sigma "-A"}))))
|
||||
|
||||
(defmethod make-obj-options :ranker
|
||||
;; Ranker :
|
||||
;;
|
||||
;; Ranks attributes by their individual evaluations. Use in conjunction with attribute evaluators (ReliefF, GainRatio, Entropy etc).
|
||||
;;
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -P <start set>
|
||||
;; Specify a starting set of attributes.
|
||||
;; Eg. 1,3,5-7.
|
||||
;; Any starting attributes specified are
|
||||
;; ignored during the ranking.
|
||||
;;
|
||||
;; -T <threshold>
|
||||
;; Specify a theshold by which attributes
|
||||
;; may be discarded from the ranking.
|
||||
;;
|
||||
;; -N <num to select>
|
||||
;; Specify number of attributes to select
|
||||
;; Ranker :
|
||||
;;
|
||||
;; Ranks attributes by their individual evaluations. Use in conjunction with attribute evaluators (ReliefF, GainRatio, Entropy etc).
|
||||
;;
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -P <start set>
|
||||
;; Specify a starting set of attributes.
|
||||
;; Eg. 1,3,5-7.
|
||||
;; Any starting attributes specified are
|
||||
;; ignored during the ranking.
|
||||
;;
|
||||
;; -T <threshold>
|
||||
;; Specify a theshold by which attributes
|
||||
;; may be discarded from the ranking.
|
||||
;;
|
||||
;; -N <num to select>
|
||||
;; Specify number of attributes to select
|
||||
([kind m]
|
||||
(->> (extract-attributes "-P" :starting-attributes)
|
||||
(check-option-values m
|
||||
|
@ -380,26 +380,26 @@
|
|||
|
||||
|
||||
(defmethod make-obj-options :one-R
|
||||
;; OneRAttributeEval :
|
||||
;;
|
||||
;; Evaluates the worth of an attribute by using the OneR classifier.
|
||||
;;
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -S <seed>
|
||||
;; Random number seed for cross validation
|
||||
;; (default = 1)
|
||||
;;
|
||||
;; -F <folds>
|
||||
;; Number of folds for cross validation
|
||||
;; (default = 10)
|
||||
;;
|
||||
;; -D
|
||||
;; Use training data for evaluation rather than cross validaton
|
||||
;;
|
||||
;; -B <minimum bucket size>
|
||||
;; Minimum number of objects in a bucket
|
||||
;; (passed on to OneR, default = 6)
|
||||
;; OneRAttributeEval :
|
||||
;;
|
||||
;; Evaluates the worth of an attribute by using the OneR classifier.
|
||||
;;
|
||||
;; Valid options are:
|
||||
;;
|
||||
;; -S <seed>
|
||||
;; Random number seed for cross validation
|
||||
;; (default = 1)
|
||||
;;
|
||||
;; -F <folds>
|
||||
;; Number of folds for cross validation
|
||||
;; (default = 10)
|
||||
;;
|
||||
;; -D
|
||||
;; Use training data for evaluation rather than cross validaton
|
||||
;;
|
||||
;; -B <minimum bucket size>
|
||||
;; Minimum number of objects in a bucket
|
||||
;; (passed on to OneR, default = 6)
|
||||
([kind m]
|
||||
(->> (check-options m {:use-training-data-for-eval "-D"})
|
||||
(check-option-values m
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
(fn [kind map] kind))
|
||||
|
||||
(declare make-apply-filter)
|
||||
;TODO: consider passing in the make-filter-options body here as well in additon to the docstring.
|
||||
;;TODO: consider passing in the make-filter-options body here as well in additon to the docstring.
|
||||
(defmacro deffilter
|
||||
"Defines the filter's fn that creates a fn to make and apply the filter."
|
||||
[filter-name]
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
[])))
|
||||
|
||||
|
||||
; TODO: Raise a helpful exception when the keys don't match up with the provided flags.
|
||||
;; TODO: Raise a helpful exception when the keys don't match up with the provided flags.
|
||||
(defn check-options
|
||||
"Checks the presence of a set of options for a filter"
|
||||
([args-map opts-map]
|
||||
|
|
|
@ -171,30 +171,30 @@
|
|||
|
||||
;; Things to load to test this from slime
|
||||
|
||||
;(defn load-test-from-slime []
|
||||
; (do
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/joda-time-1.6.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/opencsv-2.0.1.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/classes/")
|
||||
; (add-classpath "file:///Applications/weka-3-6-2/weka.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/src/")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-charts-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-core-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-io-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-processing-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-chrono-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-full-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-mongodb-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/jfreechart-1.0.13.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/parallelcolt-0.7.2.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/arpack-combo-0.1.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/gnujaxp-1.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/clojure-json-1.1-20091229.021828-4.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/clojure-db-object-0.1.1-20091229.021828-2.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/jcommon-1.0.16.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/netlib-java-0.9.1.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/processing-core-1.jar")
|
||||
; (add-classpath"file:///Users/antonio.garrote/Development/old/clj-ml/lib/congomongo-0.1.1-20091229.021828-1.jar")
|
||||
; (add-classpath"file:///Users/antonio.garrote/Development/old/clj-ml/lib/mongo-1.0.jar")
|
||||
; (add-classpath"file:///Users/antonio.garrote/Development/old/clj-ml/lib/mongo-java-driver-1.1.0-20091229.021828-3.jar")
|
||||
; ))
|
||||
;(defn load-test-from-slime []
|
||||
; (do
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/joda-time-1.6.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/opencsv-2.0.1.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/classes/")
|
||||
; (add-classpath "file:///Applications/weka-3-6-2/weka.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/src/")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-charts-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-core-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-io-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-processing-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-chrono-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-full-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/incanter-mongodb-1.0-master-SNAPSHOT.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/jfreechart-1.0.13.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/parallelcolt-0.7.2.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/arpack-combo-0.1.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/gnujaxp-1.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/clojure-json-1.1-20091229.021828-4.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/clojure-db-object-0.1.1-20091229.021828-2.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/jcommon-1.0.16.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/netlib-java-0.9.1.jar")
|
||||
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/lib/processing-core-1.jar")
|
||||
; (add-classpath"file:///Users/antonio.garrote/Development/old/clj-ml/lib/congomongo-0.1.1-20091229.021828-1.jar")
|
||||
; (add-classpath"file:///Users/antonio.garrote/Development/old/clj-ml/lib/mongo-1.0.jar")
|
||||
; (add-classpath"file:///Users/antonio.garrote/Development/old/clj-ml/lib/mongo-java-driver-1.1.0-20091229.021828-3.jar")
|
||||
; ))
|
||||
|
|
Loading…
Reference in a new issue