Coder Social home page Coder Social logo

conjecture's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

conjecture's Issues

Docs for ALSJob

Thanks for the great library. I'm working with ALSjob, but I'm missing a bit of detail on subsequent steps for producing item-item and item-user style recs. Any chance we can get some commenting on the FactorizationTools code if this is what this is? i.e I'd like to compute the outer product of U and V after the ALS job.

FTRLOptimizer model-update modifies instance

A simple example (in Clojure) showing how the FTRLOptimizer modifies an instance during an update:

(defn opt [] (doto (FTRLOptimizer.)
               (.setBeta (double 0.1)) 
               (.setAlpha (double 0.1)) 
               (.setGaussianRegularizationWeight (double 0.00000001) )
               (.setLaplaceRegularizationWeight (double  0.00000001))
               (.setExamplesPerEpoch (double  10000.0))
               (.setUseExponentialLearningRate false)
               (.setExponentialLearningRateBase (double  0.99))
               (.setInitialLearningRate (double 0.01) )))

(defn LogRegModel []
  (doto (LogisticRegression. (opt))
    (.setTruncationPeriod (int Integer/MAX_VALUE))
    (.setTruncationThreshold (double 0.0))
    (.setTruncationUpdate (double 0.0))))

;; initialize LogisticRegression Model object:
(def m (LogRegModel))
;; a simple BinaryLabeledInstance
(def ex
  (BinaryLabeledInstance. (double 1.0) ;; label
                          (StringKeyedVector. {"height" 5.11 "weight" 165.0}))) ;; features

;; update the model with the example
(doto m (.update ex))

;; the example feature-values have changed!
(.getVector ex)

;; ==> #<StringKeyedVector {"height":-2.555,"weight":-82.5}>

build is broken; demo fails

When I do sbt clean assembly I get this error:

[error] /Users/prasadch/Git/Conjecture/src/main/scala/com/etsy/scalding/jobs/conjecture/NNMFTest.scala:31: value updateGaussianWeighted is not a member of object com.etsy.conjecture.scalding.NNMF
[error]   val HW_ = NNMF.updateGaussianWeighted(A, HW._1, HW._2, alpha)

So I deleted the NNMFTest.scala and it built fine. However now when I try to run the demo (with the proper snapshot version number) I get this error because the gaussianRegularizationWeight defaults to 0, and that's not valid:

Caused by: java.lang.IllegalArgumentException: gaussian regularization weight must be positive, given: %f [0.0]
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:119)
    at com.etsy.conjecture.model.SGDOptimizer.setGaussianRegularizationWeight(SGDOptimizer.java:148)
    at com.etsy.conjecture.scalding.train.MulticlassModelTrainer.<init>(MulticlassModelTrainer.scala:144)
    at com.etsy.conjecture.demo.LearnMulticlassClassifier.<init>(LearnMulticlassClassifier.scala:27)

FTRLOptimizer model coefficients grow unboundedly large

I'm not sure if I'm setting the model parameters right, but here's a Clojure example of how after updating the model on just 100 random examples, the coefficients become huge:

;; helper fn to create a BinaryLabeledInstance from a feature->value map
(defn map2labex
  "Create a BinaryLabeledInstance from a map and label"
  [m lab]
  (BinaryLabeledInstance. (double lab)
                          (StringKeyedVector.
                           (into {} (for [[k v] m] [k (double v)]) ) )))

(defn rand-labex
  "create a vector of n random labeled examples with d numerical features in [0,1]"
  [n d]
  (let
      [num-fields (map #(str "n" %) (range d))
       one-ex (fn [] (map2labex (zipmap num-fields (repeatedly d rand))  
                               (if (> 0.5 (rand)) 0 1 )))]  ;; random 0/1 label
    (repeatedly n one-ex)))

;; create 100 random examples with 3 numerical features in [0,1]
(def examples (rand-labex 100 3))

;; update an initial model with all 100 examples
(def final-model (reduce #(doto %1 (.update %2)) (LogRegModel) examples) )

;; model coefficients are huge:
(-> final-model .getParam .getMap)
;;==> {"n2" 5.381797927731191E49, "n1" -2.010128381640754E45, "n0" 1.2177646948602788E44}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.