Skip to content

Instantly share code, notes, and snippets.

@sahil280114
Last active October 9, 2019 05:33
Show Gist options
  • Select an option

  • Save sahil280114/c51cc1e33bb665ca727f81e71f33a3a2 to your computer and use it in GitHub Desktop.

Select an option

Save sahil280114/c51cc1e33bb665ca727f81e71f33a3a2 to your computer and use it in GitHub Desktop.

Revisions

  1. sahil280114 revised this gist Aug 15, 2018. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions model.py
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    features = np.vectorize(features)

    X = features(reviews[:, 1])

    y = reviews[:, 0]
    clf = Pipeline([("dct", DictVectorizer()), ("svc", LinearSVC())])
    params = {
    "svc__C": [1e15, 1e13, 1e11, 1e9, 1e7, 1e5, 1e3, 1e1, 1e-1, 1e-3, 1e-5]
    }
    gs = GridSearchCV(clf, params, cv=10, verbose=2, n_jobs=-1)
    gs.fit(X, y)
    model = gs.best_estimator_
  2. sahil280114 revised this gist Aug 15, 2018. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion model.py
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    features = np.vectorize(features)

    X = features(reviews[:, 1])
  3. sahil280114 created this gist Aug 15, 2018.
    6 changes: 6 additions & 0 deletions model.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@

    features = np.vectorize(features)

    X = features(reviews[:, 1])

    y = reviews[:, 0]