1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-25 13:48:49 +08:00
golearn/knn/knn.h
Richard Townsend 527c6476e1 Optimised version of KNN for Euclidean distances
This patch also:
   * Completes removal of the edf/ package
   * Corrects an erroneous print statement
   * Introduces two new CSV functions
      * ParseCSVToInstancesTemplated makes sure that
        reading a second CSV file maintains strict Attribute
        compatibility with an existing DenseInstances
      * ParseCSVToInstancesWithAttributeGroups gives more control
        over where Attributes end up in memory, important for
        gaining predictable control over the KNN optimisation
      * Decouples BinaryAttributeGroup from FixedAttributeGroup for
        better casting support
2014-09-30 23:10:22 +01:00

22 lines
659 B
C

#ifndef _H_FUNCS
#define _H_FUNCS
#include <stdint.h>
struct dist {
float dist;
uint32_t p;
};
/* Works out the Euclidean distance (not square-rooted) for a given
* AttributeGroup */
void euclidean_distance (
struct dist *out, /* Output distance vector, needs to be initially zero */
int max_row, /* Size of the output vector */
int max_col, /* Number of columns */
int row, /* Current prediction row */
double *train, /* Pointer to first element of training AttributeGroup */
double *pred /* Pointer to first element of equivalent prediction AttributeGroup */
);
#endif