cmake_minimum_required(VERSION 3.7)project(command_executor)# 设置c++ 14set(CMAKE_CXX_STANDARD 14)# 遍历文件,并把文件都保存到${GLOB_RECURSE}file(GLOB_RECURSE SOURCE core/* python/* test/*)# 增加可执行文件add_executable(command_executor ${SOURCE})# 增加静态链接库add_library(command_executor STATIC ${SOURCE})# 增加动态链接库add_library(command_executor SHARED ${SOURCE})# 指定链接库target_link_libraries(command_executor -lpthread)# 添加子目录add_subdirectory(xxx)# 设置include路径include_directories(.)
发表于 2019-03-30 16:15:50 | 条评论 | 阅读次数:37
#include "Python.h"#include "core/executor.h"static PyObject *libcommand_executor_run(PyObject *self, PyObject *args) { char *commands; if(!PyArg_ParseTuple(args, "s", &commands)) { return NULL; } auto &instance = cpputil::CommandExecutor::instance(); if(instance.run(commands)) { Py_INCREF(Py_True); return Py_True; } Py_INCREF(Py_False); return Py_False;}static PyMethodDef executorMethods[] = { {"run", libcommand_executor_run, METH_VARARGS}, {NULL, NULL}};PyMODINIT_
发表于 2019-03-30 16:10:26 | 条评论 | 阅读次数:22
FM的本质是利用二阶特征 y(X)=∑i=1n∑j=i+1nWijXiXj\large y(X)=\sum\limits^n_{i=1}\sum\limits^n_{j=i+1}W_{ij}X_iX_jy(X)=​i=1​∑​n​​​j=i+1​∑​n​​W​ij​​X​i​​X​j​​ 可发现wijw_{ij}w​ij​​是对称的,可以通过近似矩阵分解,得到 Wij=VVTW_{ij}=VV^TW​ij​​=VV​T​​,其中VVV为n∗kn*kn∗k的矩阵,也就是n个长为k的隐向量。 有: y(X)=∑i=1n∑j=i+1n∑t=1k(VitXi)(VtjTXj)\large y(X)=\sum\limits^n_{i=1}\sum\limits^n_{j=i+1}\sum\limits^k_{t=1}(V_{it}X_i)(V^T_{tj}X_j)y(X)=​i=1​∑​n​​​j=i+1​∑​n​​​t=1​∑​k​​(V​it​​X​i​​)(V​tj​T​​X​j​​) VtjT=VjtV^T_{tj}=V_{jt}V​tj​T​​=V​jt​​ 因为f(i,j)=f(j,i)f(i,j
发表于 2019-03-24 00:35:43 | 条评论 | 阅读次数:30
Copyright © 2017 - 2019 qwb's blog
blog.csustacm.com All Rights Reserved
Powered by qwb Contact me