elphas / recommender
Elphas推荐器是您的数据服务。提供数据,我们进行一些分析,您将获得推荐。
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2024-09-15 21:09:25 UTC
README
Elphas推荐器是您的数据推荐服务。提供数据,我们进行一些分析,您将获得推荐。
如何安装
前往您想要使用Elphas推荐器的Laravel项目,并通过composer安装
composer require elphas/recommender
在.env文件中为您的应用程序注册API密钥和密钥
RECOMMENDER_APIKEY=<your-api-key-here>
RECOMMENDER_SECRETKEY=<your-secret-key-here>
还没有API密钥?
在这里注册: http://test.developer.elphas.ai。
创建您的第一个应用程序,并将密钥输入到.env文件中。
它的功能
Elphas推荐器是您的数据推荐服务。提供数据,我们进行一些分析,您将获得推荐。
让我们看看一个例子
如果您有一个用户群,他们都有一定的技能,您想要为您用户提供下一步学习的建议。
您可以使用Elphas推荐器做以下操作
您会创建一个集合(这是一个用于您特定数据的容器)并为它提供配置文件。这可以完全匿名进行。
配置文件看起来可能如下所示
{
"id":1357, //this is an ID generated by us
"items": //a set of skills that you supply for that user
[
"html5",
"java"
],
"reference_id":1 //this is an ID that perhaps matches an ID in your system for easier lookups later on
}
基于几个配置文件,我们可以为您的配置文件提供推荐。基于具有上述配置文件的集合,我们可以推荐以下内容
{
"augment":
[
"mysql",
"php"
],
"recommendation":
[
"android",
"css3",
"jquery",
"wordpress",
"spring",
"ios",
"mysql",
"ajax",
"php",
"tomcat"
]
}
您可以使用不同的策略来获取推荐。 了解更多关于策略
如何使用
集合
您的集合列表
Recommender::getCollections();
创建新的集合
Recommender::postCollection( 'Name of the collection' );
通过集合ID获取特定的集合
Recommender::getCollection( $collectionId );
更改集合的名称
Recommender::patchCollection( $collectionId, $name )
删除集合
请小心处理:)
Recommender::deleteCollection( $collectionId );
项目
获取集合中的独特项目
Recommender::getItems( $collectionId );
配置文件
获取集合中所有配置文件的列表
Recommender::getProfiles( $collectionId );
在集合中创建新的配置文件
$profile = new \Elphas\Recommender\Profile(); $profile->items = [ 'laravel', 'vue', 'php', 'javascript' ]; Recommender::postProfile( $collectionId, $profile ); //or $profile2 = new \Elphas\Recommender\Profile( null, null, [ 'laravel', 'vue', 'php', 'javascript' ] ); Recommender::postProfile( $collectionId, $profile2 );
提供一个引用ID,以便您可以将配置文件与自己的系统进行匹配
$profileWithRef = new \Elphas\Recommender\Profile( null, $referenceId, [ 'laravel', 'vue', 'php', 'javascript' ] ); Recommender::postProfile( $collectionId, $profileWithRef );
在集合中获取配置文件
Recommender::getProfile( $collectionId, $profileId); //by your reference ID Recommender::getProfile( $collectionId, $referenceId, true); //as an Elphas Profile instance $profile = Recommender::getProfile( $collectionId, $profileId, false, true);
在集合中更新配置文件
$profile = Recommender::getProfile( $collectionId, $profileId, false, true); $profile->items[] = 'blade'; Recommender::patchProfile( $collectionId, $profileId, $profile)
删除集合中的配置文件 请再次小心处理。
Recommender::deleteProfile( $collectionId, $profileId) //or by referenceID Recommender::deleteProfile( $collectionId, $referenceId, true)
推荐
一旦集合中填充了配置文件和项目,我们就可以根据集合中的其他配置文件对配置文件进行推荐。
Recommender::recommend( $collectionId, $profileId)
推荐可以使用三种策略:增强、推荐或全部。
获取推荐默认策略是 推荐 策略。 推荐 策略将配置文件相互比较。
增强 策略检查哪些独特项目属于一组,以及这种情况发生的频率。
全部 策略结合了策略。结果将按策略返回。
Recommender::recommend( $collectionId, $profileId, 'recommend' ) //or Recommender::recommend( $collectionId, $profileId, 'augment' ) //or Recommender::recommend( $collectionId, $profileId, 'all' )
当使用 增强 策略时,您将能够提供一个介于0和1之间的最小质量设置。
质量越高,推荐将越严格。
Recommender::recommend( $collectionId, $profileId, 'augment', 0.7 )
有一个选项可以限制推荐的数量。默认值为 10
Recommender::recommend( $collectionId, $profileId, 'augment', 0.7, 5 )
也可以根据您的参考ID进行推荐
Recommender::recommend( $collectionId, $referenceId, 'augment', 0.7, 5, true )
支持
请发送电子邮件至 dev@alledaags.nl