Skip to content

Commit

Permalink
Merged upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wfondrie committed Dec 1, 2020
2 parents 64a3629 + 768d435 commit e44f680
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 0 additions & 2 deletions mokapot/confidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,6 @@ def _assign_confidence(self, desc=True):
self.confidence_estimates[level] = data.loc[targets, :]
self.decoy_confidence_estimates[level] = data.loc[~targets, :]

print((self.confidence_estimates["proteins"]["mokapot q-value"] <= 0.01).sum())

if "proteins" not in self.confidence_estimates.keys():
self.confidence_estimates["proteins"] = None
self.decoy_confidence_estimates["proteins"] = None
Expand Down
24 changes: 12 additions & 12 deletions mokapot/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class that contains this logic. A :py:class:`Model` instance can be

import numpy as np
import pandas as pd
import sklearn.base as base
import sklearn.svm as svm
import sklearn.model_selection as ms
import sklearn.preprocessing as pp
from sklearn.base import clone
from sklearn.svm import LinearSVC
from sklearn.model_selection import GridSearchCV
from sklearn.preprocessing import StandardScaler
from sklearn.exceptions import NotFittedError

LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -133,22 +133,22 @@ def __init__(
"versions. Use the PercolatorModel class instead.",
DeprecationWarning,
)
svm_model = svm.LinearSVC(dual=False)
estimator = ms.GridSearchCV(
svm_model = LinearSVC(dual=False)
estimator = GridSearchCV(
svm_model, param_grid=PERC_GRID, refit=False, cv=3
)

self.estimator = base.clone(estimator)
self.estimator = clone(estimator)
self.features = None
self.is_trained = False
self.subset_max_train = subset_max_train

if scaler == "as-is":
self.scaler = DummyScaler()
elif scaler is None:
self.scaler = pp.StandardScaler()
self.scaler = StandardScaler()
else:
self.scaler = base.clone(scaler)
self.scaler = clone(scaler)

self.train_fdr = train_fdr
self.max_iter = max_iter
Expand Down Expand Up @@ -416,8 +416,8 @@ def __init__(
subset_max_train=None,
):
"""Initialize a PercolatorModel"""
svm_model = svm.LinearSVC(dual=False)
estimator = ms.GridSearchCV(
svm_model = LinearSVC(dual=False)
estimator = GridSearchCV(
svm_model, param_grid=PERC_GRID, refit=False, cv=3
)

Expand Down Expand Up @@ -498,7 +498,7 @@ def load_model(model_file):
logging.info("Loading the Percolator model.")

weight_cols = [c for c in weights.index if c != "m0"]
model = Model(estimator=svm.LinearSVC(), scaler="as-is")
model = Model(estimator=LinearSVC(), scaler="as-is")
weight_vals = weights.loc[weight_cols]
weight_vals = weight_vals[np.newaxis, :]
model.estimator.coef_ = weight_vals
Expand Down

0 comments on commit e44f680

Please sign in to comment.