Fixed indentation.

This commit is contained in:
Joshua Eckroth 2013-07-31 06:50:59 -04:00
parent 2945f082bb
commit db70ee980f
16 changed files with 469 additions and 469 deletions

View file

@ -16,7 +16,7 @@
"Creates the right parameters for a weka object. Returns a clojure vector." "Creates the right parameters for a weka object. Returns a clojure vector."
(fn [kind map] kind)) (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 #_(defmacro defsearch
"Defines the filter's fn that creates a fn to make and apply the filter." "Defines the filter's fn that creates a fn to make and apply the filter."
[filter-name] [filter-name]
@ -29,27 +29,27 @@
(make-apply-filter ~filter-keyword attributes# ds#)))))) (make-apply-filter ~filter-keyword attributes# ds#))))))
(defmethod make-obj-options :greedy (defmethod make-obj-options :greedy
;; -C ;; -C
;; Use conservative forward search ;; Use conservative forward search
;; ;;
;; -B ;; -B
;; Use a backward search instead of a ;; Use a backward search instead of a
;; forward one. ;; forward one.
;; ;;
;; -P <start set> ;; -P <start set>
;; Specify a starting set of attributes. ;; Specify a starting set of attributes.
;; Eg. 1,3,5-7. ;; Eg. 1,3,5-7.
;; ;;
;; -R ;; -R
;; Produce a ranked list of attributes. ;; Produce a ranked list of attributes.
;; ;;
;; -T <threshold> ;; -T <threshold>
;; Specify a theshold by which attributes ;; Specify a theshold by which attributes
;; may be discarded from the ranking. ;; may be discarded from the ranking.
;; Use in conjuction with -R ;; Use in conjuction with -R
;; ;;
;; -N <num to select> ;; -N <num to select>
;; Specify number of attributes to select ;; Specify number of attributes to select
([kind m] ([kind m]
(let [weka-opts (->> (extract-attributes "-P" :starting-attributes) (let [weka-opts (->> (extract-attributes "-P" :starting-attributes)
@ -76,45 +76,45 @@
;; -C :direction ...) ;; -C :direction ...)
(defmethod make-obj-options :linear-forward (defmethod make-obj-options :linear-forward
;; LinearForwardSelection: ;; 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). ;; 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: ;; For more information see:
;; ;;
;; Martin Guetlein (2006). Large Scale Attribute Selection Using Wrappers. Freiburg, Germany. ;; Martin Guetlein (2006). Large Scale Attribute Selection Using Wrappers. Freiburg, Germany.
;; ;;
;; Valid options are: ;; Valid options are:
;; ;;
;; -P <start set> ;; -P <start set>
;; Specify a starting set of attributes. ;; Specify a starting set of attributes.
;; Eg. 1,3,5-7. ;; Eg. 1,3,5-7.
;; ;;
;; -D <0 = forward selection | 1 = floating forward selection> ;; -D <0 = forward selection | 1 = floating forward selection>
;; Forward selection method. (default = 0). ;; Forward selection method. (default = 0).
;; ;;
;; -N <num> ;; -N <num>
;; Number of non-improving nodes to ;; Number of non-improving nodes to
;; consider before terminating search. ;; consider before terminating search.
;; ;;
;; -I ;; -I
;; Perform initial ranking to select the ;; Perform initial ranking to select the
;; top-ranked attributes. ;; top-ranked attributes.
;; ;;
;; -K <num> ;; -K <num>
;; Number of top-ranked attributes that are ;; Number of top-ranked attributes that are
;; taken into account by the search. ;; taken into account by the search.
;; ;;
;; -T <0 = fixed-set | 1 = fixed-width> ;; -T <0 = fixed-set | 1 = fixed-width>
;; Type of Linear Forward Selection (default = 0). ;; Type of Linear Forward Selection (default = 0).
;; ;;
;; -S <num> ;; -S <num>
;; Size of lookup cache for evaluated subsets. ;; Size of lookup cache for evaluated subsets.
;; Expressed as a multiple of the number of ;; Expressed as a multiple of the number of
;; attributes in the data set. (default = 1) ;; attributes in the data set. (default = 1)
;; ;;
;; -Z ;; -Z
;; verbose on/off ;; verbose on/off
([kind m] ([kind m]
(let [weka-opts (->> (let [weka-opts (->>
(extract-attributes "-P" :starting-attributes) (extract-attributes "-P" :starting-attributes)
@ -167,58 +167,58 @@
"1"))))) "1")))))
(defmethod make-obj-options :genetic (defmethod make-obj-options :genetic
;; GeneticSearch: ;; GeneticSearch:
;; ;;
;; Performs a search using the simple genetic algorithm described in Goldberg (1989). ;; Performs a search using the simple genetic algorithm described in Goldberg (1989).
;; ;;
;; For more information see: ;; For more information see:
;; ;;
;; David E. Goldberg (1989). Genetic algorithms in search, optimization and machine learning. Addison-Wesley. ;; David E. Goldberg (1989). Genetic algorithms in search, optimization and machine learning. Addison-Wesley.
;; ;;
;; BibTeX: ;; BibTeX:
;; ;;
;; @book{Goldberg1989, ;; @book{Goldberg1989,
;; author = {David E. Goldberg}, ;; author = {David E. Goldberg},
;; publisher = {Addison-Wesley}, ;; publisher = {Addison-Wesley},
;; title = {Genetic algorithms in search, optimization and machine learning}, ;; title = {Genetic algorithms in search, optimization and machine learning},
;; year = {1989}, ;; year = {1989},
;; ISBN = {0201157675} ;; ISBN = {0201157675}
;; } ;; }
;; ;;
;; ;;
;; Valid options are: ;; Valid options are:
;; ;;
;; -P <start set> ;; -P <start set>
;; Specify a starting set of attributes. ;; Specify a starting set of attributes.
;; Eg. 1,3,5-7.If supplied, the starting set becomes ;; Eg. 1,3,5-7.If supplied, the starting set becomes
;; one member of the initial random ;; one member of the initial random
;; population. ;; population.
;; ;;
;; -Z <population size> ;; -Z <population size>
;; Set the size of the population (even number). ;; Set the size of the population (even number).
;; (default = 20). ;; (default = 20).
;; ;;
;; -G <number of generations> ;; -G <number of generations>
;; Set the number of generations. ;; Set the number of generations.
;; (default = 20) ;; (default = 20)
;; ;;
;; -C <probability of crossover> ;; -C <probability of crossover>
;; Set the probability of crossover. ;; Set the probability of crossover.
;; (default = 0.6) ;; (default = 0.6)
;; ;;
;; -M <probability of mutation> ;; -M <probability of mutation>
;; Set the probability of mutation. ;; Set the probability of mutation.
;; (default = 0.033) ;; (default = 0.033)
;; ;;
;; -R <report frequency> ;; -R <report frequency>
;; Set frequency of generation reports. ;; Set frequency of generation reports.
;; e.g, setting the value to 5 will ;; e.g, setting the value to 5 will
;; report every 5th generation ;; report every 5th generation
;; (default = number of generations) ;; (default = number of generations)
;; ;;
;; -S <seed> ;; -S <seed>
;; Set the random number seed. ;; Set the random number seed.
;; (default = 1) ;; (default = 1)
([kind m] ([kind m]
(->> (extract-attributes "-P" :starting-attributes) (->> (extract-attributes "-P" :starting-attributes)
(check-option-values m (check-option-values m
@ -264,31 +264,31 @@
:ignore-locally-predictive-attrs "-L"}))) :ignore-locally-predictive-attrs "-L"})))
(defn attribute-eval-options [m] (defn attribute-eval-options [m]
;; Valid options are: ;; Valid options are:
;; ;;
;; -M ;; -M
;; treat missing values as a seperate value. ;; treat missing values as a seperate value.
;; ;;
;; -B ;; -B
;; just binarize numeric attributes instead ;; just binarize numeric attributes instead
;; of properly discretizing them. ;; of properly discretizing them.
(check-options m (check-options m
{:treat-missing-vals-separate "-M" {:treat-missing-vals-separate "-M"
:binarize-numeric-attrs "-B"})) :binarize-numeric-attrs "-B"}))
(defmethod make-obj-options :info-gain (defmethod make-obj-options :info-gain
;; InfoGainAttributeEval : ;; InfoGainAttributeEval :
;; ;;
;; Evaluates the worth of an attribute by measuring the information gain with respect to the class. ;; Evaluates the worth of an attribute by measuring the information gain with respect to the class.
;; ;;
;; InfoGain(Class,Attribute) = H(Class) - H(Class | Attribute). ;; InfoGain(Class,Attribute) = H(Class) - H(Class | Attribute).
([kind m] ([kind m]
(attribute-eval-options m))) (attribute-eval-options m)))
(defmethod make-obj-options :chi-squared (defmethod make-obj-options :chi-squared
;; ChiSquaredAttributeEval : ;; ChiSquaredAttributeEval :
;; ;;
;; Evaluates the worth of an attribute by computing the value of the chi-squared statistic with respect to the class. ;; Evaluates the worth of an attribute by computing the value of the chi-squared statistic with respect to the class.
([kind m] ([kind m]
(attribute-eval-options m))) (attribute-eval-options m)))
@ -353,24 +353,24 @@
:weight-sigma "-A"})))) :weight-sigma "-A"}))))
(defmethod make-obj-options :ranker (defmethod make-obj-options :ranker
;; Ranker : ;; Ranker :
;; ;;
;; Ranks attributes by their individual evaluations. Use in conjunction with attribute evaluators (ReliefF, GainRatio, Entropy etc). ;; Ranks attributes by their individual evaluations. Use in conjunction with attribute evaluators (ReliefF, GainRatio, Entropy etc).
;; ;;
;; Valid options are: ;; Valid options are:
;; ;;
;; -P <start set> ;; -P <start set>
;; Specify a starting set of attributes. ;; Specify a starting set of attributes.
;; Eg. 1,3,5-7. ;; Eg. 1,3,5-7.
;; Any starting attributes specified are ;; Any starting attributes specified are
;; ignored during the ranking. ;; ignored during the ranking.
;; ;;
;; -T <threshold> ;; -T <threshold>
;; Specify a theshold by which attributes ;; Specify a theshold by which attributes
;; may be discarded from the ranking. ;; may be discarded from the ranking.
;; ;;
;; -N <num to select> ;; -N <num to select>
;; Specify number of attributes to select ;; Specify number of attributes to select
([kind m] ([kind m]
(->> (extract-attributes "-P" :starting-attributes) (->> (extract-attributes "-P" :starting-attributes)
(check-option-values m (check-option-values m
@ -380,26 +380,26 @@
(defmethod make-obj-options :one-R (defmethod make-obj-options :one-R
;; OneRAttributeEval : ;; OneRAttributeEval :
;; ;;
;; Evaluates the worth of an attribute by using the OneR classifier. ;; Evaluates the worth of an attribute by using the OneR classifier.
;; ;;
;; Valid options are: ;; Valid options are:
;; ;;
;; -S <seed> ;; -S <seed>
;; Random number seed for cross validation ;; Random number seed for cross validation
;; (default = 1) ;; (default = 1)
;; ;;
;; -F <folds> ;; -F <folds>
;; Number of folds for cross validation ;; Number of folds for cross validation
;; (default = 10) ;; (default = 10)
;; ;;
;; -D ;; -D
;; Use training data for evaluation rather than cross validaton ;; Use training data for evaluation rather than cross validaton
;; ;;
;; -B <minimum bucket size> ;; -B <minimum bucket size>
;; Minimum number of objects in a bucket ;; Minimum number of objects in a bucket
;; (passed on to OneR, default = 6) ;; (passed on to OneR, default = 6)
([kind m] ([kind m]
(->> (check-options m {:use-training-data-for-eval "-D"}) (->> (check-options m {:use-training-data-for-eval "-D"})
(check-option-values m (check-option-values m

View file

@ -51,7 +51,7 @@
(fn [kind map] kind)) (fn [kind map] kind))
(declare make-apply-filter) (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 (defmacro deffilter
"Defines the filter's fn that creates a fn to make and apply the filter." "Defines the filter's fn that creates a fn to make and apply the filter."
[filter-name] [filter-name]

View file

@ -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 (defn check-options
"Checks the presence of a set of options for a filter" "Checks the presence of a set of options for a filter"
([args-map opts-map] ([args-map opts-map]

View file

@ -171,30 +171,30 @@
;; Things to load to test this from slime ;; Things to load to test this from slime
;(defn load-test-from-slime [] ;(defn load-test-from-slime []
; (do ; (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/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/lib/opencsv-2.0.1.jar")
; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/classes/") ; (add-classpath "file:///Users/antonio.garrote/Development/old/clj-ml/classes/")
; (add-classpath "file:///Applications/weka-3-6-2/weka.jar") ; (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/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-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-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-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-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-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-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/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/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/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/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/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-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/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/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/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/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/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-1.0.jar")
; (add-classpath"file:///Users/antonio.garrote/Development/old/clj-ml/lib/mongo-java-driver-1.1.0-20091229.021828-3.jar") ; (add-classpath"file:///Users/antonio.garrote/Development/old/clj-ml/lib/mongo-java-driver-1.1.0-20091229.021828-3.jar")
; )) ; ))