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

Updating documentation

parent d3f2103a
No related branches found
No related tags found
No related merge requests found
:- module(kfn, [ initAndBuildModel/8,
searchWithQuery/10,
searchNoQuery/7]).
......@@ -17,7 +18,7 @@
%% definitions for the connected function
%% TODO:
%% --Input--
%% string treeType => "kd", "vp", "rp", "max-rp", "ub", "cover", "r", "r-star", "x", "ball", "hilbert-r", "r-plus", "r-plus-plus", "spill", "oct",
%% string searchMode => "naive", "single_tree", "dual_tree", "greedy",
......@@ -29,11 +30,13 @@
%% --Output--
%%
%% --Description--
%% Initialize the Model and build it.
%%
foreign(initAndBuildModel, c, initAndBuildModel(+string, +string,
+integer, +integer, +float32,
+pointer(float_array), +integer, +integer)).
%% TODO:
%% --Input--
%% mat querySet,
%% int k
......@@ -43,12 +46,14 @@ foreign(initAndBuildModel, c, initAndBuildModel(+string, +string,
%% mat distances
%%
%% --Description--
%% Perform neighbor search on the queryset.
%%
foreign(searchWithQuery, c, searchWithQuery( +pointer(float_array), +integer, +integer,
+integer,
-pointer(float_array), -integer, -integer,
-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input--
%% int k
%%
......@@ -57,6 +62,8 @@ foreign(searchWithQuery, c, searchWithQuery( +pointer(float_array), +integer,
%% mat distances
%%
%% --Description--
%% Perform monochromatic neighbor search.
%%
foreign(searchNoQuery, c, searchNoQuery( +integer,
-pointer(float_array), -integer, -integer,
-pointer(float_array), -integer, -integer)).
......
:- module(kmeans, [ naiveKMeans/12,
dualTreeKMeans/12,
elkanKMeans/12,
......@@ -19,50 +20,111 @@
%% definitions for the connected function
%% TODO:
%% --Input--
%% int maxIterations => 1000,
%% string initialPartition => "SampleInitialzation", "RandomPartition",
%% string emptyCluster => "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster",
%% mat data,
%% int clusters => 0
%%
%% --Output--
%% vec assignments,
%% mat centroids
%%
%% --Description--
foreign(naiveKMeans, c, naiveKMeans(+integer, +integer, +integer, +pointer(float_array), +integer, +integer, +integer,
-pointer(float_array), -integer, -pointer(float_array), -integer, -integer)).
%% Runs kmeans with naive as the algorithm for the Lloyd iteration.
%%
foreign(naiveKMeans, c, naiveKMeans( +integer, +integer, +integer,
+pointer(float_array), +integer, +integer,
+integer,
-pointer(float_array), -integer,
-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input--
%% int maxIterations => 1000,
%% string initialPartition => "SampleInitialzation", "RandomPartition",
%% string emptyCluster => "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster",
%% mat data,
%% int clusters => 0
%%
%% --Output--
%% vec assignments,
%% mat centroids
%%
%% --Description--
foreign(dualTreeKMeans, c, dualTreeKMeans(+integer, +integer, +integer, +pointer(float_array), +integer, +integer, +integer,
-pointer(float_array), -integer, -pointer(float_array), -integer, -integer)).
%% Runs kmeans with dualTree as the algorithm for the Lloyd iteration.
%%
foreign(dualTreeKMeans, c, dualTreeKMeans( +integer, +integer, +integer,
+pointer(float_array), +integer, +integer,
+integer,
-pointer(float_array), -integer,
-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input--
%% int maxIterations => 1000,
%% string initialPartition => "SampleInitialzation", "RandomPartition",
%% string emptyCluster => "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster",
%% mat data,
%% int clusters => 0
%%
%% --Output--
%% vec assignments,
%% mat centroids
%%
%% --Description--
foreign(elkanKMeans, c, elkanKMeans(+integer, +integer, +integer, +pointer(float_array), +integer, +integer, +integer,
-pointer(float_array), -integer, -pointer(float_array), -integer, -integer)).
%% Runs kmeans with elkan as the algorithm for the Lloyd iteration.
%%
foreign(elkanKMeans, c, elkanKMeans( +integer, +integer, +integer,
+pointer(float_array), +integer, +integer,
+integer,
-pointer(float_array), -integer,
-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input--
%% int maxIterations => 1000,
%% string initialPartition => "SampleInitialzation", "RandomPartition",
%% string emptyCluster => "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster",
%% mat data,
%% int clusters => 0
%%
%% --Output--
%% vec assignments,
%% mat centroids
%%
%% --Description--
foreign(hamerlyKMeans, c, hamerlyKMeans(+integer, +integer, +integer, +pointer(float_array), +integer, +integer, +integer,
-pointer(float_array), -integer, -pointer(float_array), -integer, -integer)).
%% Runs kmeans with hamerly as the algorithm for the Lloyd iteration.
%%
foreign(hamerlyKMeans, c, hamerlyKMeans(+integer, +integer, +integer,
+pointer(float_array), +integer, +integer,
+integer,
-pointer(float_array), -integer,
-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input--
%% int maxIterations => 1000,
%% string initialPartition => "SampleInitialzation", "RandomPartition",
%% string emptyCluster => "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster",
%% mat data,
%% int clusters => 0
%%
%% --Output--
%% vec assignments,
%% mat centroids
%%
%% --Description--
foreign(pellegMooreKMeans, c, pellegMooreKMeans(+integer, +integer, +integer, +pointer(float_array), +integer, +integer, +integer,
-pointer(float_array), -integer, -pointer(float_array), -integer, -integer)).
%% Runs kmeans with pelleg Moore as the algorithm for the Lloyd iteration.
%%
foreign(pellegMooreKMeans, c, pellegMooreKMeans(+integer, +integer, +integer,
+pointer(float_array), +integer, +integer,
+integer,
-pointer(float_array), -integer,
-pointer(float_array), -integer, -integer)).
%% Defines the functions that get connected from main.cpp
foreign_resource(kmeans, [ naiveKMeans,
......
:- module(knn, [ initAndBuildModel/10,
searchWithQuery/10,
searchNoQuery/7]).
......@@ -17,7 +18,7 @@
%% definitions for the connected function
%% TODO:
%% --Input--
%% string treeType => "kd", "vp", "rp", "max-rp", "ub", "cover", "r", "r-star", "x", "ball", "hilbert-r", "r-plus", "r-plus-plus", "spill", "oct",
%% string searchMode => "naive", "single_tree", "dual_tree", "greedy",
......@@ -31,11 +32,14 @@
%% --Output--
%%
%% --Description--
%% Initialize the Model and build it.
%%
foreign(initAndBuildModel, c, initAndBuildModel(+string, +string,
+integer, +integer, +float32, +float32, +float32,
+integer,
+integer, +float32, +float32, +float32,
+pointer(float_array), +integer, +integer)).
%% TODO:
%% --Input--
%% mat querySet,
%% int k
......@@ -45,12 +49,14 @@ foreign(initAndBuildModel, c, initAndBuildModel(+string, +string,
%% mat distances
%%
%% --Description--
%% Perform neighbor search on the queryset.
%%
foreign(searchWithQuery, c, searchWithQuery( +pointer(float_array), +integer, +integer,
+integer,
-pointer(float_array), -integer, -integer,
-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input--
%% int k
%%
......@@ -59,6 +65,8 @@ foreign(searchWithQuery, c, searchWithQuery( +pointer(float_array), +integer,
%% mat distances
%%
%% --Description--
%% Perform monochromatic neighbor search.
%%
foreign(searchNoQuery, c, searchNoQuery( +integer,
-pointer(float_array), -integer, -integer,
-pointer(float_array), -integer, -integer)).
......
:- module(linear_SVM, [ initModelWithTrain/10,
initModelNoTrain/4,
classify/8,
......@@ -26,8 +27,11 @@
%% --Output--
%%
%% --Description--
foreign(initModelWithTrain, c, initModelWithTrain(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, +integer,
+float32, +float32, +integer, +string)).
foreign(initModelWithTrain, c, initModelWithTrain( +pointer(float_array), +integer, +integer,
+pointer(float_array), +integer,
+integer, +float32, +float32,
+integer,
+string)).
%% TODO:
%% --Input--
......@@ -35,7 +39,8 @@ foreign(initModelWithTrain, c, initModelWithTrain(+pointer(float_array), +intege
%% --Output--
%%
%% --Description--
foreign(initModelNoTrain, c, initModelNoTrain( +integer, +float32, +float32, +integer)).
foreign(initModelNoTrain, c, initModelNoTrain( +integer, +float32, +float32,
+integer)).
%% TODO:
%% --Input--
......@@ -43,7 +48,9 @@ foreign(initModelNoTrain, c, initModelNoTrain( +integer, +float32, +float32, +in
%% --Output--
%%
%% --Description--
foreign(classify, c, classify(+pointer(float_array), +integer, +integer, -pointer(float_array), -integer, -pointer(float_array), -integer, -integer)).
foreign(classify, c, classify( +pointer(float_array), +integer, +integer,
-pointer(float_array), -integer,
-pointer(float_array), -integer, -integer)).
%% TODO:
%% --Input--
......@@ -51,7 +58,8 @@ foreign(classify, c, classify(+pointer(float_array), +integer, +integer, -pointe
%% --Output--
%%
%% --Description--
foreign(classifyPoint, c, classifyPoint(+pointer(float_array), +integer, [-integer])).
foreign(classifyPoint, c, classifyPoint(+pointer(float_array), +integer,
[-integer])).
%% TODO:
%% --Input--
......@@ -59,7 +67,9 @@ foreign(classifyPoint, c, classifyPoint(+pointer(float_array), +integer, [-integ
%% --Output--
%%
%% --Description--
foreign(computeAccuracy, c, computeAccuracy(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, [-float32])).
foreign(computeAccuracy, c, computeAccuracy( +pointer(float_array), +integer, +integer,
+pointer(float_array), +integer,
[-float32])).
%% TODO:
%% --Input--
......@@ -67,7 +77,11 @@ foreign(computeAccuracy, c, computeAccuracy(+pointer(float_array), +integer, +in
%% --Output--
%%
%% --Description--
foreign(train, c, train(+pointer(float_array), +integer, +integer, +pointer(float_array), +integer, +integer, +string, [-float32])).
foreign(train, c, train(+pointer(float_array), +integer, +integer,
+pointer(float_array), +integer,
+integer,
+string,
[-float32])).
%% Defines the functions that get connected from main.cpp
......
:- module(lmnn, [lmnn/20]).
%% requirements of library(struct)
......@@ -15,27 +16,29 @@
%% definitions for the connected function
%% TODO:
%% --Input--
%% string optimizer,
%% string optimizer => "amsgrad", "bbsgd", "sgd", "lbfgs",
%% mat data,
%% vec labels,
%% int k,
%% float32 regularization,
%% float32 stepSize,
%% int passes,
%% int maxIterations,
%% int tolerance,
%% bool center => (1)true / (0)false,
%% int k => 1,
%% float32 regularization => 0.5,
%% float32 stepSize => 0.01,
%% int passes => 50,
%% int maxIterations => 100000,
%% int tolerance => 1e-7,
%% bool center => (1)true / (0)false => false,
%% bool shuffle => (1)true / (0)false,
%% int batchSize,
%% int range,
%% int rank,
%% int batchSize => 50,
%% int range => 1,
%% int rank => 0,
%%
%% --Output--
%% mat distance
%%
%% --Description--
%% Is a single predicate that initiates the lmnn model with all the given params and then performs Large Margin Nearest Neighbors metric learning on the reference data.
%%
foreign(lmnn, c, lmnn( +string,
+pointer(float_array), +integer, +integer,
+pointer(float_array), +integer,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment