madlib-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From orhankislal <...@git.apache.org>
Subject [GitHub] madlib pull request #229: SVM: Add minibatch as a new solver
Date Wed, 24 Jan 2018 21:59:05 GMT
Github user orhankislal commented on a diff in the pull request:

    https://github.com/apache/madlib/pull/229#discussion_r163120094
  
    --- Diff: src/modules/convex/linear_svm_igd.cpp ---
    @@ -120,6 +124,100 @@ linear_svm_igd_transition::run(AnyType &args) {
         return state;
     }
     
    +/**
    + * @brief Perform the linear support vector machine transition step
    + *
    + * Called for each tuple.
    + */
    +AnyType
    +linear_svm_igd_minibatch_transition::run(AnyType &args) {
    +    // The real state.
    +    // For the first tuple: args[0] is nothing more than a marker that
    +    // indicates that we should do some initial operations.
    +    // For other tuples: args[0] holds the computation state until last tuple
    +    SVMMinibatchState<MutableArrayHandle<double> > state = args[0];
    +
    +    // initialize the state if first tuple
    +    if (state.algo.numRows == 0) {
    +
    +        LinearSVM<GLMModel, GLMTuple >::epsilon = args[9].getAs<double>();;
    +        LinearSVM<GLMModel, GLMTuple >::is_svc = args[10].getAs<bool>();;
    +        if (!args[3].isNull()) {
    +            SVMMinibatchState<ArrayHandle<double> > previousState = args[3];
    +            state.allocate(*this, previousState.task.nFeatures);
    +            state = previousState;
    +        } else {
    +            // configuration parameters
    +            uint32_t dimension = args[4].getAs<uint32_t>();
    +            state.allocate(*this, dimension); // with zeros
    +        }
    +        // resetting in either case
    +        // state.reset();
    --- End diff --
    
    We should remove these lines if we don't need them.


---

Mime
View raw message