Skip to content

Commit

Permalink
fixed imports (#1220)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored and guolinke committed Jan 26, 2018
1 parent 0a9725b commit d22de3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion python-package/lightgbm/basic.py
Expand Up @@ -15,7 +15,7 @@

from .compat import (DataFrame, Series, integer_types, json,
json_default_with_numpy, numeric_types, range_,
string_type, LGBMDeprecationWarning)
string_type)
from .libpath import find_lib_path


Expand Down
1 change: 0 additions & 1 deletion python-package/lightgbm/libpath.py
@@ -1,7 +1,6 @@
# coding: utf-8
"""Find the path to lightgbm dynamic library files."""
import os
import sys


def find_lib_path():
Expand Down
16 changes: 5 additions & 11 deletions python-package/lightgbm/sklearn.py
Expand Up @@ -4,19 +4,13 @@
from __future__ import absolute_import

import numpy as np
import warnings
try:
import pandas as pd
_IS_PANDAS_INSTALLED = True
except ImportError:
_IS_PANDAS_INSTALLED = False

from .basic import Dataset, LightGBMError
from .compat import (SKLEARN_INSTALLED, _LGBMClassifierBase,
LGBMNotFittedError, _LGBMLabelEncoder, _LGBMModelBase,
_LGBMRegressorBase, _LGBMCheckXY, _LGBMCheckArray, _LGBMCheckConsistentLength,
_LGBMCheckClassificationTargets, _LGBMComputeSampleWeight,
argc_, range_, LGBMDeprecationWarning)
argc_, range_, DataFrame)
from .engine import train


Expand Down Expand Up @@ -414,7 +408,7 @@ def fit(self, X, y,
feval = None
params['metric'] = eval_metric

if not _IS_PANDAS_INSTALLED or not isinstance(X, pd.DataFrame):
if not isinstance(X, DataFrame):
X, y = _LGBMCheckXY(X, y, accept_sparse=True, force_all_finite=False, ensure_min_samples=2)
_LGBMCheckConsistentLength(X, y, sample_weight)

Expand Down Expand Up @@ -504,7 +498,7 @@ def predict(self, X, raw_score=False, num_iteration=0):
"""
if self._n_features is None:
raise LGBMNotFittedError("Estimator not fitted, call `fit` before exploiting the model.")
if not _IS_PANDAS_INSTALLED or not isinstance(X, pd.DataFrame):
if not isinstance(X, DataFrame):
X = _LGBMCheckArray(X, accept_sparse=True, force_all_finite=False)
n_features = X.shape[1]
if self._n_features != n_features:
Expand All @@ -531,7 +525,7 @@ def apply(self, X, num_iteration=0):
"""
if self._n_features is None:
raise LGBMNotFittedError("Estimator not fitted, call `fit` before exploiting the model.")
if not _IS_PANDAS_INSTALLED or not isinstance(X, pd.DataFrame):
if not isinstance(X, DataFrame):
X = _LGBMCheckArray(X, accept_sparse=True, force_all_finite=False)
n_features = X.shape[1]
if self._n_features != n_features:
Expand Down Expand Up @@ -708,7 +702,7 @@ def predict_proba(self, X, raw_score=False, num_iteration=0):
"""
if self._n_features is None:
raise LGBMNotFittedError("Estimator not fitted, call `fit` before exploiting the model.")
if not _IS_PANDAS_INSTALLED or not isinstance(X, pd.DataFrame):
if not isinstance(X, DataFrame):
X = _LGBMCheckArray(X, accept_sparse=True, force_all_finite=False)
n_features = X.shape[1]
if self._n_features != n_features:
Expand Down

0 comments on commit d22de3c

Please sign in to comment.