Skip to content
Snippets Groups Projects
Commit 901beba4 authored by Dean Samuel Schmitz's avatar Dean Samuel Schmitz
Browse files

Update documentation

parent 64bcc847
No related branches found
No related tags found
No related merge requests found
:- module(local_coordinate_coding, [ initModelWithTrain/8, :- module(local_coordinate_coding, [ initModelWithTrain/8,
initModelNoTrain/5, initModelNoTrain/5,
encode/6, encode/6,
...@@ -20,35 +21,41 @@ ...@@ -20,35 +21,41 @@
%% definitions for the connected function %% definitions for the connected function
%% TODO:
%% --Input-- %% --Input--
%% mat data, %% mat data,
%% bool normalize => (1)true / (0)false, %% bool normalize => (1)true / (0)false => false,
%% int atoms, %% int atoms => 0,
%% float32 lambda, %% float32 lambda => 0.0,
%% int maxIterations => 0, %% int maxIterations => 0,
%% float32 tolerance => 0.01 %% float32 tolerance => 0.01
%% %%
%% --Output-- %% --Output--
%% %%
%% --Description-- %% --Description--
%% Initializes the model and trains it so encode/6 can be called after
%%
foreign(initModelWithTrain, c, initModelWithTrain( +pointer(float_array), +integer, +integer, foreign(initModelWithTrain, c, initModelWithTrain( +pointer(float_array), +integer, +integer,
+integer, +integer, +float32, +integer, +float32)). +integer,
+integer, +float32, +integer, +float32)).
%% TODO:
%% --Input-- %% --Input--
%% bool normalize => (1)true / (0)false, %% bool normalize => (1)true / (0)false => false,
%% int atoms, %% int atoms => 0,
%% float32 lambda, %% float32 lambda => 0.0,
%% int maxIterations => 0, %% int maxIterations => 0,
%% float32 tolerance => 0.01 %% float32 tolerance => 0.01
%% %%
%% --Output-- %% --Output--
%% %%
%% --Description-- %% --Description--
foreign(initModelNoTrain, c, initModelNoTrain(+integer, +integer, +float32, +integer, +float32)). %% Initializes the model but doesnt train it so train/4 has to be called befor encode/6 can be used.
%%
foreign(initModelNoTrain, c, initModelNoTrain( +integer,
+integer, +float32, +integer, +float32)).
%% TODO:
%% --Input-- %% --Input--
%% mat data %% mat data
%% %%
...@@ -56,9 +63,12 @@ foreign(initModelNoTrain, c, initModelNoTrain(+integer, +integer, +float32, +int ...@@ -56,9 +63,12 @@ foreign(initModelNoTrain, c, initModelNoTrain(+integer, +integer, +float32, +int
%% mat codes %% mat codes
%% %%
%% --Description-- %% --Description--
foreign(encode, c, encode(+pointer(float_array), +integer, +integer, -pointer(float_array), -integer, -integer)). %% Code each point via distance-weighted LARS.
%%
foreign(encode, c, encode( +pointer(float_array), +integer, +integer,
-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input-- %% --Input--
%% mat data %% mat data
%% %%
...@@ -67,9 +77,13 @@ foreign(encode, c, encode(+pointer(float_array), +integer, +integer, -pointer(fl ...@@ -67,9 +77,13 @@ foreign(encode, c, encode(+pointer(float_array), +integer, +integer, -pointer(fl
%% vec adjacencies %% vec adjacencies
%% %%
%% --Description-- %% --Description--
foreign(objective, c, objective(+pointer(float_array), +integer, +integer, -pointer(float_array), -integer, -integer, -pointer(float_array), -integer)). %% Compute objective function given the list of adjacencies.
%%
foreign(objective, c, objective(+pointer(float_array), +integer, +integer,
-pointer(float_array), -integer, -integer,
-pointer(float_array), -integer)).
%% TODO:
%% --Input-- %% --Input--
%% mat data %% mat data
%% %%
...@@ -78,9 +92,13 @@ foreign(objective, c, objective(+pointer(float_array), +integer, +integer, -poin ...@@ -78,9 +92,13 @@ foreign(objective, c, objective(+pointer(float_array), +integer, +integer, -poin
%% vec adjacencies %% vec adjacencies
%% %%
%% --Description-- %% --Description--
foreign(optimizeDictionary, c, optimizeDictionary(+pointer(float_array), +integer, +integer, -pointer(float_array), -integer, -integer, -pointer(float_array), -integer)). %% Learn dictionary by solving linear system.
%%
foreign(optimizeDictionary, c, optimizeDictionary( +pointer(float_array), +integer, +integer,
-pointer(float_array), -integer, -integer,
-pointer(float_array), -integer)).
%% TODO:
%% --Input-- %% --Input--
%% mat data %% mat data
%% %%
...@@ -88,7 +106,10 @@ foreign(optimizeDictionary, c, optimizeDictionary(+pointer(float_array), +intege ...@@ -88,7 +106,10 @@ foreign(optimizeDictionary, c, optimizeDictionary(+pointer(float_array), +intege
%% float32 final objective value %% float32 final objective value
%% %%
%% --Description-- %% --Description--
foreign(train, c, train(+pointer(float_array), +integer, +integer, [-float32])). %% Run local coordinate coding and train the model.
%%
foreign(train, c, train(+pointer(float_array), +integer, +integer,
[-float32])).
%% Defines the functions that get connected from main.cpp %% Defines the functions that get connected from main.cpp
......
:- module(lsh, [initModel/8, :- module(lsh, [initModel/8,
computeRecall/7, computeRecall/7,
searchWithQuery/12, searchWithQuery/12,
...@@ -19,11 +20,11 @@ ...@@ -19,11 +20,11 @@
%% definitions for the connected function %% definitions for the connected function
%% TODO:
%% --Input-- %% --Input--
%% mat referenceSet, %% mat referenceSet,
%% int numProj, %% int numProj => 10-50,
%% int numTables, %% int numTables => 10-20,
%% float32 hashWidth => 0.0, %% float32 hashWidth => 0.0,
%% int secondHashSize => 99901, %% int secondHashSize => 99901,
%% int bucketSize => 500 %% int bucketSize => 500
...@@ -31,9 +32,11 @@ ...@@ -31,9 +32,11 @@
%% --Output-- %% --Output--
%% %%
%% --Description-- %% --Description--
%% Initiatzes the model and trains it.
%%
foreign(initModel, c, initModel(+pointer(float_array), +integer, +integer, +integer, +integer, +float32, +integer, +integer)). foreign(initModel, c, initModel(+pointer(float_array), +integer, +integer, +integer, +integer, +float32, +integer, +integer)).
%% TODO:
%% --Input-- %% --Input--
%% mat foundNeighbors, %% mat foundNeighbors,
%% mat realNeighbors %% mat realNeighbors
...@@ -42,12 +45,14 @@ foreign(initModel, c, initModel(+pointer(float_array), +integer, +integer, +inte ...@@ -42,12 +45,14 @@ foreign(initModel, c, initModel(+pointer(float_array), +integer, +integer, +inte
%% float32 recall percentage => values in between [0,1] %% float32 recall percentage => values in between [0,1]
%% %%
%% --Description-- %% --Description--
%% Compute the recall (% of neighbors found) given the neighbors returned by searchWithQuery/12 or searchNoQuery/9 and a "ground truth" set of neighbors.
%%
foreign(computeRecall, c, computeRecall(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, +integer, [-float32])). foreign(computeRecall, c, computeRecall(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, +integer, [-float32])).
%% TODO:
%% --Input-- %% --Input--
%% mat querySet, %% mat querySet,
%% int k, %% int k => 0,
%% int numTablesToSearch => 0, %% int numTablesToSearch => 0,
%% int T => 0 %% int T => 0
%% %%
...@@ -56,11 +61,14 @@ foreign(computeRecall, c, computeRecall(+pointer(float_array), +integer, +intege ...@@ -56,11 +61,14 @@ foreign(computeRecall, c, computeRecall(+pointer(float_array), +integer, +intege
%% mat distances %% mat distances
%% %%
%% --Description-- %% --Description--
%% Compute the nearest neighbors of the points in the given query set and store the output in the given matrices.
%% The matrices will be set to the size of n columns by k rows, where n is the number of points in the query dataset and k is the number of neighbors being searched for.
%%
foreign(searchWithQuery, c, searchWithQuery(+pointer(float_array), +integer, +integer, +integer, -pointer(float_array), -integer, -integer, -pointer(float_array), -integer, -integer, +integer, +integer)). foreign(searchWithQuery, c, searchWithQuery(+pointer(float_array), +integer, +integer, +integer, -pointer(float_array), -integer, -integer, -pointer(float_array), -integer, -integer, +integer, +integer)).
%% TODO:
%% --Input-- %% --Input--
%% int k, %% int k => 0,
%% int numTablesToSearch => 0, %% int numTablesToSearch => 0,
%% int T => 0 %% int T => 0
%% %%
...@@ -69,13 +77,16 @@ foreign(searchWithQuery, c, searchWithQuery(+pointer(float_array), +integer, +in ...@@ -69,13 +77,16 @@ foreign(searchWithQuery, c, searchWithQuery(+pointer(float_array), +integer, +in
%% mat distances %% mat distances
%% %%
%% --Description-- %% --Description--
%% Compute the nearest neighbors and store the output in the given matrices.
%% The matrices will be set to the size of n columns by k rows, where n is the number of points in the query dataset and k is the number of neighbors being searched for.
%%
foreign(searchNoQuery, c, searchNoQuery(+integer, -pointer(float_array), -integer, -integer, -pointer(float_array), -integer, -integer, +integer, +integer)). foreign(searchNoQuery, c, searchNoQuery(+integer, -pointer(float_array), -integer, -integer, -pointer(float_array), -integer, -integer, +integer, +integer)).
%% TODO:
%% --Input-- %% --Input--
%% mat referenceSet, %% mat referenceSet,
%% int numProj, %% int numProj => 10-50,
%% int numTables, %% int numTables => 10-20,
%% float32 hashWidth => 0.0, %% float32 hashWidth => 0.0,
%% int secondHashSize => 99901, %% int secondHashSize => 99901,
%% int bucketSize => 500 %% int bucketSize => 500
...@@ -83,6 +94,8 @@ foreign(searchNoQuery, c, searchNoQuery(+integer, -pointer(float_array), -intege ...@@ -83,6 +94,8 @@ foreign(searchNoQuery, c, searchNoQuery(+integer, -pointer(float_array), -intege
%% --Output-- %% --Output--
%% %%
%% --Description-- %% --Description--
%% Train the LSH model on the given dataset.
%%
foreign(train, c, train(+pointer(float_array), +integer, +integer, +integer, +integer, +float32, +integer, +integer)). foreign(train, c, train(+pointer(float_array), +integer, +integer, +integer, +integer, +float32, +integer, +integer)).
......
:- module(mean_shift, [meanShift/12]). :- module(mean_shift, [meanShift/12]).
%% requirements of library(struct) %% requirements of library(struct)
...@@ -17,19 +18,24 @@ ...@@ -17,19 +18,24 @@
%% --Input-- %% --Input--
%% double radius => 0 %% flaot32 radius => 0,
%% int maxIterations %% int maxIterations => 1000,
%% mat data => data(float_array), dataSize, dataRowNum %% mat data,
%% bool forceConvergence => (1)true / (0)false %% bool forceConvergence => (1)true / (0)false => true,
%% bool useSeeds => (1)true / (0)false %% bool useSeeds => (1)true / (0)false => true
%% %%
%% --Output-- %% --Output--
%% vec assignments => assign(float_array), assignSize %% vec assignments,
%% mat centroids => cent(float_array), centColNum, centRowNum %% mat centroids
%% %%
%% --Description-- %% --Description--
foreign(meanShift, c, meanShift(+float32, +integer, +pointer(float_array), +integer, +integer, -pointer(float_array), -integer, %% Perform mean shift clustering on the data, returning a list of cluster assignments and centroids.
-pointer(float_array), -integer, -integer, +integer, +integer)). %%
foreign(meanShift, c, meanShift(+float32, +integer,
+pointer(float_array), +integer, +integer,
-pointer(float_array), -integer,
-pointer(float_array), -integer, -integer,
+integer, +integer)).
%% Defines the functions that get connected from main.cpp %% Defines the functions that get connected from main.cpp
......
:- module(naive_bayes_classifier, [ initModelWithTrain/8, :- module(naive_bayes_classifier, [ initModelWithTrain/8,
initModelNoTrain/3, initModelNoTrain/3,
...@@ -23,77 +24,121 @@ ...@@ -23,77 +24,121 @@
%% definitions for the connected function %% definitions for the connected function
%% TODO:
%% --Input-- %% --Input--
%% mat data,
%% vec labels,
%% int numClasses => 0,
%% bool incrementalVariance => (1)true / (0)false => false,
%% float32 epsilon => 1e-10
%% %%
%% --Output-- %% --Output--
%% %%
%% --Description-- %% --Description--
%% Initializes the classifier as per the input and then trains it by calculating the sample mean and variances.
%%
foreign(initModelWithTrain, c, initModelWithTrain(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, +integer, +integer, +float32)). foreign(initModelWithTrain, c, initModelWithTrain(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, +integer, +integer, +float32)).
%% TODO:
%% --Input-- %% --Input--
%% int numClasses => 0,
%% bool incrementalVariance => (1)true / (0)false => false,
%% float32 epsilon => 1e-10
%% %%
%% --Output-- %% --Output--
%% %%
%% --Description-- %% --Description--
%% Initialize the Naive Bayes classifier without performing training.
%% All of the parameters of the model will be initialized to zero. Be sure to use train before calling classify, otherwise the results may be meaningless.
%%
foreign(initModelNoTrain, c, initModelNoTrain(+integer, +integer, +float32)). foreign(initModelNoTrain, c, initModelNoTrain(+integer, +integer, +float32)).
%% TODO:
%% --Input-- %% --Input--
%% mat data
%% %%
%% --Output-- %% --Output--
%% vec predictions,
%% mat probabilities
%% %%
%% --Description-- %% --Description--
%% Classify the given points using the trained NaiveBayesClassifier model and also return estimates of the probabilities for each class in the given matrix.
%% The predicted labels for each point are stored in the given vector.
%%
%%foreign(classifyPoint, c, classifyPoint(+pointer(float_array), +integer, -integer, -pointer(float_array), -integer)). %%foreign(classifyPoint, c, classifyPoint(+pointer(float_array), +integer, -integer, -pointer(float_array), -integer)).
%% TODO:
%% --Input-- %% --Input--
%% mat data
%% %%
%% --Output-- %% --Output--
%% vec predictions,
%% mat probabilities
%% %%
%% --Description-- %% --Description--
%% Classify the given points using the trained NaiveBayesClassifier model and also return estimates of the probabilities for each class in the given matrix.
%% The predicted labels for each point are stored in the given vector.
%%
foreign(classifyMatrix, c, classifyMatrix(+pointer(float_array), +integer, +integer, -pointer(float_array), -integer, -pointer(float_array), -integer, -integer)). foreign(classifyMatrix, c, classifyMatrix(+pointer(float_array), +integer, +integer, -pointer(float_array), -integer, -pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input-- %% --Input--
%% %%
%% --Output-- %% --Output--
%% mat means
%% %%
%% --Description-- %% --Description--
%% Get the sample means for each class.
%%
foreign(means, c, means(-pointer(float_array), -integer, -integer)). foreign(means, c, means(-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input-- %% --Input--
%% %%
%% --Output-- %% --Output--
%% mat probabilities
%% %%
%% --Description-- %% --Description--
%% Get the sample probabilities for each class.
%%
foreign(probabilities, c, probabilities(-pointer(float_array), -integer, -integer)). foreign(probabilities, c, probabilities(-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input-- %% --Input--
%% mat data,
%% vec labels,
%% int numClasses => 0,
%% bool incrementalVariance => (1)true / (0)false => false
%% %%
%% --Output-- %% --Output--
%% %%
%% --Description-- %% --Description--
%% Train the Naive Bayes classifier on the given dataset. The data must be the same dimensionality as the existing model parameters.
%%
foreign(trainMatrix, c, trainMatrix(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, +integer, +integer)). foreign(trainMatrix, c, trainMatrix(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, +integer, +integer)).
%% TODO:
%% --Input-- %% --Input--
%% vec point,
%% int label
%% %%
%% --Output-- %% --Output--
%% %%
%% --Description-- %% --Description--
%% Train the Naive Bayes classifier on the given point.
%% This will use the incremental algorithm for updating the model parameters. The data must be the same dimensionality as the existing model parameters.
%%
foreign(trainPoint, c, trainPoint(+pointer(float_array), +integer, +integer)). foreign(trainPoint, c, trainPoint(+pointer(float_array), +integer, +integer)).
%% TODO:
%% --Input-- %% --Input--
%% %%
%% --Output-- %% --Output--
%% mat variances
%% %%
%% --Description-- %% --Description--
%% Get the sample variances for each class.
%%
foreign(variances, c, variances(-pointer(float_array), -integer, -integer)). foreign(variances, c, variances(-pointer(float_array), -integer, -integer)).
......
...@@ -15,20 +15,20 @@ ...@@ -15,20 +15,20 @@
%% definitions for the connected function %% definitions for the connected function
%% TODO:
%% --Input-- %% --Input--
%% string optimizerType => "sgd", "lbfgs", %% string optimizerType => "sgd", "lbfgs",
%% float32 stepSize used in "sgd", %% float32 stepSize => 0.01 , used in "sgd",
%% int maxIterations used in "sgd, lbfgs", %% int maxIterations => 500000 , used in "sgd, lbfgs",
%% float32 tolerance used in "sgd", %% float32 tolerance => 1e-7 , used in "sgd",
%% bool shuffle => (1)true / (0)false, used in "sgd", %% bool shuffle => (1)true / (0)false, => 0.01 , used in "sgd",
%% int numBasis used in "lbfgs", %% int numBasis => 5 , used in "lbfgs",
%% float32 armijoConstant used in "lbfgs", %% float32 armijoConstant => 0.0001 , used in "lbfgs",
%% float32 wolfe used in "lbfgs", %% float32 wolfe => 0.9 , used in "lbfgs",
%% int maxLineSearchTrials used in "lbfgs", %% int maxLineSearchTrials => 50 , used in "lbfgs",
%% float32 minStep used in "lbfgs", %% float32 minStep => 1e-20 , used in "lbfgs",
%% float32 maxStep used in "lbfgs", %% float32 maxStep => 1e+20 , used in "lbfgs",
%% int batchSize used in "sgd", %% int batchSize => 50 , used in "sgd",
%% mat data, %% mat data,
%% vec labels %% vec labels
%% %%
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
%% mat distance %% mat distance
%% %%
%% --Description-- %% --Description--
%% Initialize the nca model and the selected optimizer.
%%
%% Then perform nca on the given data and return the learned distance.
%%
foreign(nca, c, nca( +string, foreign(nca, c, nca( +string,
+float32, +integer, +float32, +float32, +integer, +float32,
+integer, +integer,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment