Hi all, I have the following code that trains a perceptron with the
given inputs and corresponding desired inputs. For input/output
vectors, when the size gets to about 2000, I am getting a
java.lang.StackOverflowError in the following function:

(defn trainPerceptron [beginningWeightVector allInputs allOutputs]
  (loop [weightVector beginningWeightVector
         inputs allInputs
         responses allOutputs]
        (if (and (not (empty? inputs)) (not (empty? responses)))
            (let [adaptedWeightVector
                  (getAdaptedWeightVector
                    weightVector
                    (first inputs)
                    (first responses)
                    (computeActualResponse signum weightVector (first
inputs)))]
                 (recur adaptedWeightVector (rest inputs) (rest
responses)))
            weightVector)))

Is not the purpose of loop/recur to avoid stack overflow problems?
What am I doing wrong?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to