diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/README.markdown b/README.markdown index 4caa2be..5b22d5c 100644 --- a/README.markdown +++ b/README.markdown @@ -115,8 +115,8 @@ the jar manually. ```clojure REPL>(use 'clj-ml.classifiers) - REPL>; Building a classifier using a C4.5 decission tree - REPL>(def classifier (make-classifier :decission-tree :c45)) + REPL>; Building a classifier using a C4.5 decision tree + REPL>(def classifier (make-classifier :decision-tree :c45)) REPL>; We set the class attribute for the loaded dataset REPL>(dataset-set-class ds 4) diff --git a/src/clj_ml/classifiers.clj b/src/clj_ml/classifiers.clj index 9864992..e407c88 100644 --- a/src/clj_ml/classifiers.clj +++ b/src/clj_ml/classifiers.clj @@ -6,7 +6,7 @@ (ns #^{:author "Antonio Garrote "} clj-ml.classifiers "This namespace contains several functions for building classifiers using different - classification algorithms: Bayes networks, multilayer perceptron, decission tree or + classification algorithms: Bayes networks, multilayer perceptron, decision tree or support vector machines are available. Some of these classifiers have incremental versions so they can be built without having all the dataset instances in memory. @@ -17,8 +17,8 @@ (use 'clj-ml.classifiers) - ; Building a classifier using a C4.5 decission tree - (def *classifier* (make-classifier :decission-tree :c45)) + ; Building a classifier using a C4.5 decision tree + (def *classifier* (make-classifier :decision-tree :c45)) ; We set the class attribute for the loaded dataset. ; *dataset* is supposed to contain a set of instances. @@ -77,7 +77,7 @@ "Creates the right parameters for a classifier" (fn [kind algorithm map] [kind algorithm])) -(defmethod make-classifier-options [:decission-tree :c45] +(defmethod make-classifier-options [:decision-tree :c45] ([kind algorithm map] (let [cols-val (check-options {:unpruned "-U" :reduced-error-pruning "-R" @@ -154,11 +154,11 @@ "Creates a new classifier for the given kind algorithm and options. The first argument identifies the kind of classifier and the second - argument the algorithm to use, e.g. :decission-tree :c45. + argument the algorithm to use, e.g. :decision-tree :c45. The classifiers currently supported are: - - :decission-tree :c45 + - :decision-tree :c45 - :bayes :naive - :neural-network :mutilayer-perceptron - :support-vector-machine :smo @@ -169,9 +169,9 @@ This is the description of the supported classifiers and the accepted option parameters for each of them: - * :decission-tree :c45 + * :decision-tree :c45 - A classifier building a pruned or unpruned C 4.5 decission tree using + A classifier building a pruned or unpruned C 4.5 decision tree using Weka J 4.8 implementation. Parameters: @@ -271,7 +271,7 @@ " (fn [kind algorithm & options] [kind algorithm])) -(defmethod make-classifier [:decission-tree :c45] +(defmethod make-classifier [:decision-tree :c45] ([kind algorithm & options] (make-classifier-m kind algorithm J48 options))) diff --git a/test/clj_ml/classifiers_test.clj b/test/clj_ml/classifiers_test.clj index 5475d6d..10af664 100644 --- a/test/clj_ml/classifiers_test.clj +++ b/test/clj_ml/classifiers_test.clj @@ -4,7 +4,7 @@ (deftest make-classifiers-options-c45 - (let [options (make-classifier-options :decission-tree :c45 {:unpruned true :reduced-error-pruning true :only-binary-splits true :no-raising true + (let [options (make-classifier-options :decision-tree :c45 {:unpruned true :reduced-error-pruning true :only-binary-splits true :no-raising true :no-cleanup true :laplace-smoothing true :pruning-confidence 0.12 :minimum-instances 10 :pruning-number-folds 5 :random-seed 1})] (is (= (aget options 0) @@ -40,12 +40,12 @@ (deftest make-classifier-c45 - (let [c (make-classifier :decission-tree :c45)] + (let [c (make-classifier :decision-tree :c45)] (is (= (class c) weka.classifiers.trees.J48)))) (deftest train-classifier-c45 - (let [c (make-classifier :decission-tree :c45) + (let [c (make-classifier :decision-tree :c45) ds (clj-ml.data/make-dataset "test" [:a :b {:c [:m :n]}] [[1 2 :m] [4 5 :m]])] (clj-ml.data/dataset-set-class ds 2) (classifier-train c ds) @@ -71,7 +71,7 @@ (deftest classifier-evaluate-dataset - (let [c (make-classifier :decission-tree :c45) + (let [c (make-classifier :decision-tree :c45) ds (clj-ml.data/make-dataset "test" [:a :b {:c [:m :n]}] [[1 2 :m] [4 5 :m]]) tds (clj-ml.data/make-dataset "test" [:a :b {:c [:m :n]}] [[4 1 :n] [4 5 :m]]) foo1(clj-ml.data/dataset-set-class ds 2) @@ -87,7 +87,7 @@ (deftest classifier-evaluate-cross-validation - (let [c (make-classifier :decission-tree :c45) + (let [c (make-classifier :decision-tree :c45) ds (clj-ml.data/make-dataset "test" [:a :b {:c [:m :n]}] [[1 2 :m] [4 5 :m]]) foo1(clj-ml.data/dataset-set-class ds 2) foo2 (classifier-train c ds)