-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpixelsne.h
More file actions
executable file
·35 lines (30 loc) · 1.84 KB
/
pixelsne.h
File metadata and controls
executable file
·35 lines (30 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef PIXELSNE_H
#define PIXELSNE_H
#include "ptree.h"
static inline double sign(double x) { return (x == .0 ? .0 : (x < .0 ? -1.0 : 1.0)); }
class PixelSNE
{
private:
PTree* tree;
public:
PixelSNE();
~PixelSNE();
void run(double* X, int N, int D, double* Y, int no_dims, double perplexity, double theta,
unsigned int bins, int p_method, int rand_seed, bool skip_random_init, int max_iter=1000, int stop_lying_iter=250,
int mom_switch_iter=250);
bool load_data(double** data, int* n, int* d, int* no_dims, double* theta, double* perplexity, unsigned int* bins, int* p_method, int* rand_seed);
void save_data(double* data, int* landmarks, double* costs, int n, int d);
void symmetrizeMatrix(unsigned long long** row_P, unsigned long long** col_P, double** val_P, int N); // should be static!
private:
void computeGradient(double* P, unsigned long long* inp_row_P, unsigned long long* inp_col_P, double* inp_val_P, double* Y, int N, int D, double* dC, double theta, double beta, unsigned int bins, int iter_cnt);
void computeExactGradient(double* P, double* Y, int N, int D, double* dC);
double evaluateError(double* P, double* Y, int N, int D);
double evaluateError(unsigned long long* row_P, unsigned long long* col_P, double* val_P, double* Y, int N, int D, double theta, double beta, unsigned int bins, int iter_cnt);
void zeroMean(double* X, int N, int D);
double minmax(double* X, int N, int D, double beta, unsigned int bins, int iter_cnt);
void computeGaussianPerplexity(double* X, int N, int D, double* P, double perplexity);
void computeGaussianPerplexity(double* X, int N, int D, unsigned long long** _row_P, unsigned long long** _col_P, double** _val_P, double perplexity, int K);
void computeSquaredEuclideanDistance(double* X, int N, int D, double* DD);
double randn();
};
#endif