Skip to content

Commit

Permalink
Fixed format for TCI checks
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools authored and Tych0n committed Mar 29, 2019
1 parent 7070445 commit 5fb45e8
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 22 deletions.
4 changes: 2 additions & 2 deletions benchmarks/benchmark_als.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import logging
from collections import defaultdict

import matplotlib.pyplot as plt
import scipy.io
import seaborn

import matplotlib.pyplot as plt
import seaborn
from implicit._als import calculate_loss
from implicit.als import AlternatingLeastSquares
from implicit.nearest_neighbours import bm25_weight
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/benchmark_spark.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
import json
import time

import matplotlib.pyplot as plt
import numpy
import scipy.io

import implicit
import matplotlib.pyplot as plt
import seaborn
from pyspark import SparkConf, SparkContext
from pyspark.ml.recommendation import ALS
from pyspark.sql import Row, SparkSession

import implicit


def convert_sparse_to_dataframe(spark, context, sparse_matrix):
""" Converts a scipy sparse matrix to a spark dataframe """
Expand Down
4 changes: 2 additions & 2 deletions examples/lastfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
import codecs
import logging
import time
import tqdm

import numpy as np
import tqdm

from implicit.als import AlternatingLeastSquares
from implicit.approximate_als import (AnnoyAlternatingLeastSquares, FaissAlternatingLeastSquares,
NMSLibAlternatingLeastSquares)
from implicit.bpr import BayesianPersonalizedRanking
from implicit.datasets.lastfm import get_lastfm
from implicit.nearest_neighbours import (BM25Recommender, CosineRecommender,
TFIDFRecommender, bm25_weight)
from implicit.datasets.lastfm import get_lastfm

# maps command line model argument to class name
MODELS = {"als": AlternatingLeastSquares,
Expand Down
6 changes: 2 additions & 4 deletions examples/movielens.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@
import codecs
import logging
import time
import tqdm

import numpy as np
import tqdm

from implicit.als import AlternatingLeastSquares
from implicit.bpr import BayesianPersonalizedRanking
from implicit.datasets.movielens import get_movielens
from implicit.nearest_neighbours import (BM25Recommender, CosineRecommender,
TFIDFRecommender, bm25_weight)

from implicit.datasets.movielens import get_movielens


log = logging.getLogger("implicit")


Expand Down
6 changes: 1 addition & 5 deletions implicit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from . import als, approximate_als, bpr, nearest_neighbours
from .als import alternating_least_squares

from . import als
from . import approximate_als
from . import bpr
from . import nearest_neighbours

__version__ = '0.3.8'

__all__ = [alternating_least_squares, als, approximate_als, bpr, nearest_neighbours, __version__]
2 changes: 1 addition & 1 deletion implicit/als.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import heapq
import logging
import time
import tqdm

import numpy as np
import scipy
import scipy.sparse
import tqdm

import implicit.cuda

Expand Down
3 changes: 1 addition & 2 deletions implicit/approximate_als.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

import numpy

from implicit.als import AlternatingLeastSquares
import implicit.cuda

from implicit.als import AlternatingLeastSquares

log = logging.getLogger("implicit")

Expand Down
4 changes: 2 additions & 2 deletions implicit/evaluation.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ def mean_average_precision_at_k(model, train_user_items, test_user_items, int K=
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.nonecheck(False)
def ALS_recommend_all(
model, users_items, int k=10, int threads=1, show_progress=True, recalculate_user=False, filter_already_liked_items=False):
def ALS_recommend_all(model, users_items, int k=10, int threads=1, show_progress=True,
recalculate_user=False, filter_already_liked_items=False):

if not isinstance(users_items, csr_matrix):
users_items = users_items.tocsr()
Expand Down
2 changes: 1 addition & 1 deletion implicit/nearest_neighbours.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from numpy import bincount, log, log1p, sqrt
from scipy.sparse import coo_matrix, csr_matrix

from ._nearest_neighbours import all_pairs_knn, NearestNeighboursScorer
from ._nearest_neighbours import NearestNeighboursScorer, all_pairs_knn
from .recommender_base import RecommenderBase
from .utils import nonzeros

Expand Down

0 comments on commit 5fb45e8

Please sign in to comment.