file
stringlengths
6
44
content
stringlengths
38
162k
reader.py
"""This module contains the Reader class.""" from .builtin_datasets import BUILTIN_DATASETS class Reader: """The Reader class is used to parse a file containing ratings. Such a file is assumed to specify only one rating per line, and each line needs to respect the following structure: :: user ...
__init__.py
from pkg_resources import get_distribution from . import dump, model_selection from .builtin_datasets import get_dataset_dir from .dataset import Dataset from .prediction_algorithms import ( AlgoBase, BaselineOnly, CoClustering, KNNBaseline, KNNBasic, KNNWithMeans, KNNWithZScore, NMF,...
builtin_datasets.py
"""This module contains built-in datasets that can be automatically downloaded.""" import errno import os import zipfile from collections import namedtuple from os.path import join from urllib.request import urlretrieve def get_dataset_dir(): """Return folder where downloaded datasets and other data are stored....
__main__.py
#!/usr/bin/env python import argparse import os import random as rd import shutil import sys import numpy as np import surprise.dataset as dataset from surprise import __version__ from surprise.builtin_datasets import get_dataset_dir from surprise.dataset import Dataset from surprise.model_selection import cross_val...
trainset.py
"""This module contains the Trainset class.""" import numpy as np class Trainset: """A trainset contains all useful data that constitute a training set. It is used by the :meth:`fit() <surprise.prediction_algorithms.algo_base.AlgoBase.fit>` method of every prediction algorithm. You should not try t...
utils.py
"""The utils module contains the get_rng function.""" import numbers import numpy as np def get_rng(random_state): """Return a 'validated' RNG. If random_state is None, use RandomState singleton from numpy. Else if it's an integer, consider it's a seed and initialized an rng with that seed. If it...
search.py
from abc import ABC, abstractmethod from itertools import product import numpy as np from joblib import delayed, Parallel from ..dataset import DatasetUserFolds from ..utils import get_rng from .split import get_cv from .validation import fit_and_score class BaseSearchCV(ABC): """Base class for hyper parameter...
__init__.py
from .search import GridSearchCV, RandomizedSearchCV from .split import ( KFold, LeaveOneOut, PredefinedKFold, RepeatedKFold, ShuffleSplit, train_test_split, ) from .validation import cross_validate __all__ = [ "KFold", "ShuffleSplit", "train_test_split", "RepeatedKFold", "...
validation.py
""" The validation module contains the cross_validate function, inspired from the mighty scikit learn. """ import time import numpy as np from joblib import delayed, Parallel from .. import accuracy from .split import get_cv def cross_validate( algo, data, measures=["rmse", "mae"], cv=None, re...
split.py
""" The :mod:`model_selection.split<surprise.model_selection.split>` module contains various cross-validation iterators. Design and tools are inspired from the mighty scikit learn. The available iterators are: .. autosummary:: :nosignatures: KFold RepeatedKFold ShuffleSplit LeaveOneOut Predef...
knns.py
""" the :mod:`knns` module includes some k-NN inspired algorithms. """ import heapq import numpy as np from .algo_base import AlgoBase from .predictions import PredictionImpossible # Important note: as soon as an algorithm uses a similarity measure, it should # also allow the bsl_options parameter because of the ...
algo_base.py
""" The :mod:`surprise.prediction_algorithms.algo_base` module defines the base class :class:`AlgoBase` from which every single prediction algorithm has to inherit. """ import heapq from .. import similarities as sims from .optimize_baselines import baseline_als, baseline_sgd from .predictions import Prediction, Predi...
random_pred.py
""" Algorithm predicting a random rating. """ import numpy as np from .algo_base import AlgoBase class NormalPredictor(AlgoBase): """Algorithm predicting a random rating based on the distribution of the training set, which is assumed to be normal. The prediction :math:`\\hat{r}_{ui}` is generated from...
predictions.py
""" The :mod:`surprise.prediction_algorithms.predictions` module defines the :class:`Prediction` named tuple and the :class:`PredictionImpossible` exception. """ from collections import namedtuple class PredictionImpossible(Exception): r"""Exception raised when a prediction is impossible. When raised, the ...
__init__.py
""" The :mod:`prediction_algorithms` package includes the prediction algorithms available for recommendation. The available prediction algorithms are: .. autosummary:: :nosignatures: random_pred.NormalPredictor baseline_only.BaselineOnly knns.KNNBasic knns.KNNWithMeans knns.KNNWithZScore ...
baseline_only.py
""" This class implements the baseline estimation. """ from .algo_base import AlgoBase class BaselineOnly(AlgoBase): r"""Algorithm predicting the baseline estimate for given user and item. :math:`\hat{r}_{ui} = b_{ui} = \mu + b_u + b_i` If user :math:`u` is unknown, then the bias :math:`b_u` is assumed...
linux_dependencies.py
import os import traceback import sys print("before function process") def process(version): print("inside fun process") currentDirectory = os.path.dirname(os.path.abspath(__file__)) print(currentDirectory) try: from os.path import expanduser import platform import subprocess ...
dependencies.py
import os import traceback def process(version): currentDirectory = os.path.dirname(os.path.abspath(__file__)) try: import win32com.client from os.path import expanduser import platform import subprocess import sys import demoji try: print('Do...
__init__.py
''' * * ============================================================================= * COPYRIGHT NOTICE * ============================================================================= * @ Copyright HCL Technologies Ltd. 2021, 2022,2023 * Proprietary and confidential. All information contained herein is, and * remains...
visualization.py
''' * * ============================================================================= * COPYRIGHT NOTICE * ============================================================================= * @ Copyright HCL Technologies Ltd. 2021, 2022,2023 * Proprietary and confidential. All information contained herein is, and * remains...
local_pipeline.py
import docker import json import logging def read_json(file_path): data = None with open(file_path,'r') as f: data = json.load(f) return data def run_pipeline(inputconfig): inputconfig = json.loads(inputconfig) logfilepath = input...
build_container.py
import os import shutil import sys import subprocess from os.path import expanduser import platform import json def createDockerImage(model_name,model_version,module,folderpath): command = 'docker pull python:3.8-slim-buster' os.system(command); subprocess.check_call(["docker", "build", "-t",module+'_'+model_name...
git_upload.py
import os import sys import json from pathlib import Path import subprocess import shutil import argparse def create_and_save_yaml(git_storage_path, container_label,usecasepath): file_name_prefix = 'gh-acr-' yaml_file = f"""\ name: gh-acr-{container_label} on: push: branches: main paths: {con...
__init__.py
''' * * ============================================================================= * COPYRIGHT NOTICE * ============================================================================= * @ Copyright HCL Technologies Ltd. 2021, 2022,2023 * Proprietary and confidential. All information contained herein is, and * remains...
kafka_consumer.py
from kafka import KafkaConsumer from json import loads import pandas as pd import json import os,sys import time import multiprocessing from os.path import expanduser import platform import datetime modelDetails = {} class Process(multiprocessing.Process): def __init__(self, modelSignature,jsonData,predictedData,mo...