mmlspark.recommendation package¶
Submodules¶
mmlspark.recommendation.RankingAdapter module¶
-
class
mmlspark.recommendation.RankingAdapter.
RankingAdapter
(itemCol=None, k=10, labelCol='label', minRatingsPerItem=1, minRatingsPerUser=1, mode='allUsers', ratingCol=None, recommender=None, userCol=None)[source]¶ Bases:
mmlspark.core.schema.Utils.ComplexParamsMixin
,pyspark.ml.util.JavaMLReadable
,pyspark.ml.util.JavaMLWritable
,pyspark.ml.wrapper.JavaEstimator
- Parameters
itemCol (str) – Column of items
k (int) – number of items (default: 10)
labelCol (str) – The name of the label column (default: label)
minRatingsPerItem (int) – min ratings for items > 0 (default: 1)
minRatingsPerUser (int) – min ratings for users > 0 (default: 1)
mode (str) – recommendation mode (default: allUsers)
ratingCol (str) – Column of ratings
recommender (object) – estimator for selection
userCol (str) – Column of users
-
setLabelCol
(value)[source]¶ - Parameters
labelCol (str) – The name of the label column (default: label)
-
setMinRatingsPerItem
(value)[source]¶ - Parameters
minRatingsPerItem (int) – min ratings for items > 0 (default: 1)
-
setMinRatingsPerUser
(value)[source]¶ - Parameters
minRatingsPerUser (int) – min ratings for users > 0 (default: 1)
-
setParams
(itemCol=None, k=10, labelCol='label', minRatingsPerItem=1, minRatingsPerUser=1, mode='allUsers', ratingCol=None, recommender=None, userCol=None)[source]¶ Set the (keyword only) parameters
- Parameters
itemCol (str) – Column of items
k (int) – number of items (default: 10)
labelCol (str) – The name of the label column (default: label)
minRatingsPerItem (int) – min ratings for items > 0 (default: 1)
minRatingsPerUser (int) – min ratings for users > 0 (default: 1)
mode (str) – recommendation mode (default: allUsers)
ratingCol (str) – Column of ratings
recommender (object) – estimator for selection
userCol (str) – Column of users
-
class
mmlspark.recommendation.RankingAdapter.
RankingAdapterModel
(java_model=None)[source]¶ Bases:
mmlspark.core.schema.Utils.ComplexParamsMixin
,pyspark.ml.wrapper.JavaModel
,pyspark.ml.util.JavaMLWritable
,pyspark.ml.util.JavaMLReadable
Model fitted by
RankingAdapter
.This class is left empty on purpose. All necessary methods are exposed through inheritance.
mmlspark.recommendation.RankingAdapterModel module¶
-
class
mmlspark.recommendation.RankingAdapterModel.
RankingAdapterModel
(itemCol=None, k=10, labelCol='label', minRatingsPerItem=1, minRatingsPerUser=1, mode='allUsers', ratingCol=None, recommender=None, recommenderModel=None, userCol=None)[source]¶ Bases:
mmlspark.core.schema.Utils.ComplexParamsMixin
,pyspark.ml.util.JavaMLReadable
,pyspark.ml.util.JavaMLWritable
,pyspark.ml.wrapper.JavaTransformer
- Parameters
itemCol (str) – Column of items
k (int) – number of items (default: 10)
labelCol (str) – The name of the label column (default: label)
minRatingsPerItem (int) – min ratings for items > 0 (default: 1)
minRatingsPerUser (int) – min ratings for users > 0 (default: 1)
mode (str) – recommendation mode (default: allUsers)
ratingCol (str) – Column of ratings
recommender (object) – estimator for selection
recommenderModel (object) – recommenderModel
userCol (str) – Column of users
-
setLabelCol
(value)[source]¶ - Parameters
labelCol (str) – The name of the label column (default: label)
-
setMinRatingsPerItem
(value)[source]¶ - Parameters
minRatingsPerItem (int) – min ratings for items > 0 (default: 1)
-
setMinRatingsPerUser
(value)[source]¶ - Parameters
minRatingsPerUser (int) – min ratings for users > 0 (default: 1)
-
setParams
(itemCol=None, k=10, labelCol='label', minRatingsPerItem=1, minRatingsPerUser=1, mode='allUsers', ratingCol=None, recommender=None, recommenderModel=None, userCol=None)[source]¶ Set the (keyword only) parameters
- Parameters
itemCol (str) – Column of items
k (int) – number of items (default: 10)
labelCol (str) – The name of the label column (default: label)
minRatingsPerItem (int) – min ratings for items > 0 (default: 1)
minRatingsPerUser (int) – min ratings for users > 0 (default: 1)
mode (str) – recommendation mode (default: allUsers)
ratingCol (str) – Column of ratings
recommender (object) – estimator for selection
recommenderModel (object) – recommenderModel
userCol (str) – Column of users
mmlspark.recommendation.RankingEvaluator module¶
-
class
mmlspark.recommendation.RankingEvaluator.
RankingEvaluator
(itemCol=None, k=10, labelCol='label', metricName='ndcgAt', nItems=-1, predictionCol='prediction', ratingCol=None, userCol=None)[source]¶ Bases:
mmlspark.core.schema.Utils.ComplexParamsMixin
,pyspark.ml.util.JavaMLReadable
,pyspark.ml.util.JavaMLWritable
,pyspark.ml.evaluation.JavaEvaluator
- Parameters
itemCol (str) – Column of items
k (int) – number of items (default: 10)
labelCol (str) – label column name (default: label)
metricName (str) – metric name in evaluation (ndcgAt|map|precisionAtk|recallAtK|diversityAtK|maxDiversity|mrr|fcp) (default: ndcgAt)
nItems (long) – number of items (default: -1)
predictionCol (str) – prediction column name (default: prediction)
ratingCol (str) – Column of ratings
userCol (str) – Column of users
-
getMetricName
()[source]¶ - Returns
metric name in evaluation (ndcgAt|map|precisionAtk|recallAtK|diversityAtK|maxDiversity|mrr|fcp) (default: ndcgAt)
- Return type
-
setMetricName
(value)[source]¶ - Parameters
metricName (str) – metric name in evaluation (ndcgAt|map|precisionAtk|recallAtK|diversityAtK|maxDiversity|mrr|fcp) (default: ndcgAt)
-
setParams
(itemCol=None, k=10, labelCol='label', metricName='ndcgAt', nItems=-1, predictionCol='prediction', ratingCol=None, userCol=None)[source]¶ Set the (keyword only) parameters
- Parameters
itemCol (str) – Column of items
k (int) – number of items (default: 10)
labelCol (str) – label column name (default: label)
metricName (str) – metric name in evaluation (ndcgAt|map|precisionAtk|recallAtK|diversityAtK|maxDiversity|mrr|fcp) (default: ndcgAt)
nItems (long) – number of items (default: -1)
predictionCol (str) – prediction column name (default: prediction)
ratingCol (str) – Column of ratings
userCol (str) – Column of users
mmlspark.recommendation.RankingTrainValidationSplit module¶
-
class
mmlspark.recommendation.RankingTrainValidationSplit.
RankingTrainValidationSplit
(estimator=None, estimatorParamMaps=None, evaluator=None, seed=None)[source]¶ Bases:
pyspark.ml.base.Estimator
,pyspark.ml.tuning.ValidatorParams
-
copy
(extra=None)[source]¶ Creates a copy of this instance with a randomly generated uid and some extra com.microsoft.ml.spark.core.serialize.params. This copies creates a deep copy of the embedded paramMap, and copies the embedded and extra parameters over.
- Parameters
extra – Extra parameters to copy to the new instance
- Returns
Copy of this instance
-
getItemCol
()[source]¶ - Returns
column name for item ids. Ids must be within the integer value range. (default: item)
- Return type
-
getUserCol
()[source]¶ - Returns
column name for user ids. Ids must be within the integer value range. (default: user)
- Return type
-
itemCol
= Param(parent='undefined', name='itemCol', doc='itemCol: column name for item ids. Ids must be within the integer value range. (default: item)')¶
-
ratingCol
= Param(parent='undefined', name='ratingCol', doc='ratingCol: column name for ratings (default: rating)')¶
-
setItemCol
(value)[source]¶ - Parameters
itemCol (str) – column name for item ids. Ids must be within the integer value range. (default: item)
-
setParams
(estimator=None, estimatorParamMaps=None, evaluator=None, seed=None)[source]¶ setParams(self, estimator=None, estimatorParamMaps=None, evaluator=None, numFolds=3, seed=None): Sets com.microsoft.ml.spark.core.serialize.params for cross validator.
-
setTrainRatio
(value)[source]¶ Sets the value of
trainRatio
.
-
setUserCol
(value)[source]¶ - Parameters
userCol (str) – column name for user ids. Ids must be within the integer value range. (default: user)
-
trainRatio
= Param(parent='undefined', name='trainRatio', doc='Param for ratio between train and validation data. Must be between 0 and 1.')¶
-
userCol
= Param(parent='undefined', name='userCol', doc='userCol: column name for user ids. Ids must be within the integer value range. (default: user)')¶
-
mmlspark.recommendation.RankingTrainValidationSplitModel module¶
-
class
mmlspark.recommendation.RankingTrainValidationSplitModel.
RankingTrainValidationSplitModel
(bestModel=None, validationMetrics=[])[source]¶ Bases:
mmlspark.recommendation._RankingTrainValidationSplitModel._RankingTrainValidationSplitModel
,pyspark.ml.tuning.ValidatorParams
-
bestModel
= None¶ best model from cross validation
-
copy
(extra=None)[source]¶ Creates a copy of this instance with a randomly generated uid and some extra com.microsoft.ml.spark.core.serialize.params. This copies the underlying bestModel, creates a deep copy of the embedded paramMap, and copies the embedded and extra parameters over. And, this creates a shallow copy of the validationMetrics.
- Parameters
extra – Extra parameters to copy to the new instance
- Returns
Copy of this instance
-
validationMetrics
= None¶ evaluated validation metrics
-
mmlspark.recommendation.RecommendationIndexer module¶
-
class
mmlspark.recommendation.RecommendationIndexer.
RecommendationIndexer
(itemInputCol=None, itemOutputCol=None, ratingCol=None, userInputCol=None, userOutputCol=None)[source]¶ Bases:
mmlspark.core.schema.Utils.ComplexParamsMixin
,pyspark.ml.util.JavaMLReadable
,pyspark.ml.util.JavaMLWritable
,pyspark.ml.wrapper.JavaEstimator
- Parameters
-
class
mmlspark.recommendation.RecommendationIndexer.
RecommendationIndexerModel
(java_model=None)[source]¶ Bases:
mmlspark.core.schema.Utils.ComplexParamsMixin
,pyspark.ml.wrapper.JavaModel
,pyspark.ml.util.JavaMLWritable
,pyspark.ml.util.JavaMLReadable
Model fitted by
RecommendationIndexer
.This class is left empty on purpose. All necessary methods are exposed through inheritance.
mmlspark.recommendation.RecommendationIndexerModel module¶
-
class
mmlspark.recommendation.RecommendationIndexerModel.
RecommendationIndexerModel
(itemIndexModel=None, itemInputCol=None, itemOutputCol=None, ratingCol=None, userIndexModel=None, userInputCol=None, userOutputCol=None)[source]¶ Bases:
mmlspark.core.schema.Utils.ComplexParamsMixin
,pyspark.ml.util.JavaMLReadable
,pyspark.ml.util.JavaMLWritable
,pyspark.ml.wrapper.JavaTransformer
- Parameters
mmlspark.recommendation.SAR module¶
-
class
mmlspark.recommendation.SAR.
SAR
(activityTimeFormat="yyyy/MM/dd'T'h:mm:ss", alpha=1.0, checkpointInterval=10, coldStartStrategy='nan', finalStorageLevel='MEMORY_AND_DISK', implicitPrefs=False, intermediateStorageLevel='MEMORY_AND_DISK', itemCol='item', maxIter=10, nonnegative=False, numItemBlocks=10, numUserBlocks=10, predictionCol='prediction', rank=10, ratingCol='rating', regParam=0.1, seed=-1219638142, similarityFunction='jaccard', startTime=None, startTimeFormat='EEE MMM dd HH:mm:ss Z yyyy', supportThreshold=4, timeCol='time', timeDecayCoeff=30, userCol='user')[source]¶ Bases:
mmlspark.recommendation._SAR._SAR
mmlspark.recommendation.SARModel module¶
-
class
mmlspark.recommendation.SARModel.
SARModel
(activityTimeFormat="yyyy/MM/dd'T'h:mm:ss", alpha=1.0, checkpointInterval=10, coldStartStrategy='nan', finalStorageLevel='MEMORY_AND_DISK', implicitPrefs=False, intermediateStorageLevel='MEMORY_AND_DISK', itemCol='item', itemDataFrame=None, maxIter=10, nonnegative=False, numItemBlocks=10, numUserBlocks=10, predictionCol='prediction', rank=10, ratingCol='rating', regParam=0.1, seed=-809975865, similarityFunction='jaccard', startTime=None, startTimeFormat='EEE MMM dd HH:mm:ss Z yyyy', supportThreshold=4, timeCol='time', timeDecayCoeff=30, userCol='user', userDataFrame=None)[source]¶ Bases:
mmlspark.recommendation._SARModel._SARModel
Module contents¶
MicrosoftML is a library of Python classes to interface with the Microsoft scala APIs to utilize Apache Spark to create distibuted machine learning models.
MicrosoftML simplifies training and scoring classifiers and regressors, as well as facilitating the creation of models using the CNTK library, images, and text.