1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-26 13:49:14 +08:00
golearn/linear_models/integration.h
Richard Townsend 5ceb4e7111 linear_models: fix cgo issues, upgrade to liblinear 2.14
Requires an additional step to install:
 - cd /tmp &&
 - wget https://github.com/cjlin1/liblinear/archive/v241.tar.gz
 - tar xvf v241.tar.gz
 - cd liblinear-241
 - make lib
 - sudo install -vm644 linear.h /usr/include
 - sudo install -vm755 liblinear.so.4 /usr/lib
 - sudo ln -sfv liblinear.so.4 /usr/lib/liblinear.so
2020-09-06 10:01:24 +01:00

25 lines
934 B
C

#ifndef _H_INTEGRATION_
#define _H_INTEGRATION_
#include "linear.h"
struct problem *CreateCProblem();
void FreeCProblem(struct problem*);
struct model *CreateCModel();
void FreeCModel(struct model*);
struct parameter *CreateCParameter();
void FreeCParameter(struct parameter*);
// Allocates memory outside of golang for describing feature
// vectors. First pointer is the C-managed liblinear problem,
// second parameter is the number of rows we're training on
// third parameter is the total number of non-zero elements
// (including bias and null terminators) that we need to allocate
// and final parameter is an array describing the number of
// nodes in each row.
int AllocateFeatureNodesForProblem(struct problem*, int, int, int*);
int AllocateLabelsForProblem(struct problem *, int);
void AssignLabelForProblem(struct problem *, int, double);
struct feature_node *GetFeatureNodeForIndex(struct problem *, int, int);
#endif