Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified MeanShift
Binary file not shown.
2 changes: 1 addition & 1 deletion MeanShift.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct Cluster {
class MeanShift {
public:
MeanShift() { set_kernel(NULL); }
MeanShift(double (*_kernel_func)(double,double)) { set_kernel(kernel_func); }
MeanShift(double (*_kernel_func)(double,double)) { set_kernel(_kernel_func); }
std::vector<std::vector<double> > meanshift(const std::vector<std::vector<double> > &, double);
std::vector<Cluster> cluster(const std::vector<std::vector<double> > &, double);

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ To cluster a set of points, create a MeanShift object and call the `cluster` met
## Example
```cpp
vector<vector<double> > points = load_points("test_simple.csv");
MeanShift *ms = new MeanShift(NULL);
MeanShift *ms = new MeanShift();
double kernel_bandwidth = 2;
vector<vector<double> > shifted_points = ms->cluster(points, 2);
vector<Cluster > clusters = ms->cluster(points, 2);
```

## Visualization for Linux
Expand All @@ -36,7 +36,7 @@ The program will generate a csv file named "result.csv".
Plot it
```bash
gnuplot
plot 'test.csv' with points, 'result.csv' with points
plot 'test.csv' using 1:2 "%lf,%lf", 'result.csv' using 1:2 "%lf,%lf"
```

## License
Expand Down
2 changes: 1 addition & 1 deletion cpp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ int main(int argc, char **argv)
for(int point = 0; point < clusters[cluster].original_points.size(); point++){
for(int dim = 0; dim < clusters[cluster].original_points[point].size(); dim++) {
printf("%f ", clusters[cluster].original_points[point][dim]);
fprintf(fp, dim?",%f":"%f", clusters[cluster].original_points[point][dim]);
}
printf(" -> ");
for(int dim = 0; dim < clusters[cluster].shifted_points[point].size(); dim++) {
printf("%f ", clusters[cluster].shifted_points[point][dim]);
fprintf(fp, dim?",%f":"%f", clusters[cluster].shifted_points[point][dim]);
}
printf("\n");
fprintf(fp, "\n");
Expand Down
Loading