Commit 60e0a602 authored by Kruyff,D.L.W. (Dylan)'s avatar Kruyff,D.L.W. (Dylan)
Browse files

Code cleanup

parent 60e9b4f7
......@@ -2,7 +2,6 @@ import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { SettingsComponent } from './settings/settings.component';
import { OverviewWindowComponent } from './overview-window/overview-window.component';
import * as PlotlyJS from 'plotly.js/dist/plotly.js';
......@@ -30,7 +29,6 @@ PlotlyModule.plotlyjs = PlotlyJS;
@NgModule({
declarations: [
AppComponent,
SettingsComponent,
OverviewWindowComponent,
LabelingWindowComponent,
TableOverviewComponent,
......
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import { StateService } from '../state.service';
import zingchart from 'zingchart/es6';
import * as d3 from 'd3';
@Component({
selector: 'app-overview-window',
......@@ -35,7 +34,6 @@ export class OverviewWindowComponent implements OnInit {
async ngOnInit(): Promise<void> {
this.initialHeight = this.el.nativeElement.offsetHeight;
// this.state.onNewData.subscribe(() => this.dostuff3());
this.state.onNewData.subscribe(() => this.initializePlot());
this.state.onNewLshData.subscribe(() => {
this.showingCandidates = false;
......@@ -162,15 +160,6 @@ export class OverviewWindowComponent implements OnInit {
},
placement: 'top',
},
// plot: {
// exact: false,
// smartSampling: true,
// sampleStep: 1, // scroll step 1 is not sampling. Setting this this value to 2 will sample every other data point
// scrollStepMultiplier: 5,
// hintTs: true, // tells the library you have timestamps as keys and activates a small optimization technique
// maxNodes: 150, // max nodes to have event listeners for eg) tooltips wont show but crosshair will
// maxTrackers: 150,
// },
'scale-y': {
zooming: false,
'auto-fit': true
......@@ -238,13 +227,8 @@ export class OverviewWindowComponent implements OnInit {
data: this.config,
output: 'canvas'
});
// await this.debugClicked();
}
// changeSelection() {
// this.state.selection = [0, 1, 2];
// }
async updateChannels() {
console.log('updating plot');
......
input {
width: 30px;
}
.small-margin {
margin-right: 10px;
}
.settings-container {
display: flex;
}
<div class="settings-container">
<button class="small-margin" (click)="reset()">Full Reset</button>
<button class="small-margin" (click)="newTables()">Generate random tables</button>
<label class="small-margin" for="windowsize">Window Size:</label><br>
<input class="small-margin" [(ngModel)]="windowSize" id="windowsize">
<label class="small-margin" for="hashsize">Hash Size:</label><br>
<input class="small-margin" [(ngModel)]="hashSize" id="hashsize">
<label class="small-margin" for="nroftables">Number of tables:</label><br>
<input class="small-margin" [(ngModel)]="nrOfTables" id="nroftables">
</div>
import { Component, OnInit } from '@angular/core';
import {StateService} from '../state.service';
@Component({
selector: 'app-settings',
templateUrl: './settings.component.html',
styleUrls: ['./settings.component.css']
})
export class SettingsComponent implements OnInit {
private _windowSize;
private _hashSize;
private _nrOfTables;
constructor(private state: StateService) { }
ngOnInit(): void {
this._windowSize = this.state.windowSize;
this._hashSize = this.state.hashSize;
this._nrOfTables = this.state.nrOfTables;
}
public reset() {
this.state.windowSize = Number(this._windowSize);
this.state.hashSize = Number(this._hashSize);
this.state.nrOfTables = Number(this._nrOfTables);
this.state.reset();
}
public newTables() {
this.state.hashSize = Number(this._hashSize);
this.state.nrOfTables = Number(this._nrOfTables);
this.state.lshInitial();
}
public get windowSize() {
return this._windowSize;
}
public set windowSize(v) {
this._windowSize = v;
}
public get hashSize() {
return this._hashSize;
}
public set hashSize(v) {
this._hashSize = v;
}
public get nrOfTables() {
return this._nrOfTables;
}
public set nrOfTables(v) {
this._nrOfTables = v;
}
}
import { Component, OnInit } from '@angular/core';
import * as d3 from 'd3';
import {StateService} from '../state.service';
import * as PlotlyJS from 'plotly.js/dist/plotly.js';
@Component({
......@@ -127,81 +126,6 @@ export class StateManagementComponent implements OnInit {
this.plot = plot;
}
// initializePlot(): void {
// console.log('creating plot');
// console.log(this.hoveredNode);
// console.log(this.state.states);
// const subplots = [];
// const data = [];
// this.state.selection.forEach((channelIndex: number, index: number) => {
// const channel = this.state.states[this.hoveredNode.toString()].state.queryWindow[channelIndex];
// data.push({
// x: [...Array(channel.length).keys()],
// y: channel,
// type: 'line',
// xaxis: 'x',
// yaxis: `y${index + 2}`,
// line: {
// color: this.state.colors[channelIndex],
// }
// });
// subplots.push([`xy${index + 2}`]);
// });
//
// const plot = {
// data: data,
// layout: {
// grid: {
// rows: this.state.selection.length,
// columns: 1,
// subplots: subplots,
// },
// showlegend: false,
// hovermode: 'closest',
// autosize: true,
// margin: {
// l: 30,
// r: 30,
// t: 30,
// b: 0,
// pad: 4
// },
// height: 100 * this.state.selection.length,
// width: 300,
// titlefont: {
// size: 9
// },
// xaxis: {
// showgrid: false,
// zeroline: false,
// showticklabels: false,
// },
// yaxis: {
// zeroline: false,
// showticklabels: false,
// }
// }
// };
// this.state.selection.forEach((channel: number, index: number) => {
// plot.layout[`yaxis${index + 2}`] = {
// zeroline: false,
// showticklabels: false,
// annotations: [{
// xref: 'paper',
// yref: 'paper',
// x: 0,
// xanchor: 'right',
// y: 1,
// yanchor: 'bottom',
// text: 'X axis label',
// showarrow: false
// }]
// // title: this.state.rawData[channel].name
// };
// });
// this.plot = plot;
// }
createStateTree() {
console.log('Creating tree!');
......@@ -216,7 +140,6 @@ export class StateManagementComponent implements OnInit {
.attr("transform", "translate("
+ margin.left + "," + margin.top + ")");
let root;
const data = this.state.states;
this.selectedNode = d3.hierarchy(data[1], function(d) { return d.children ? d.children.map(function(child) {return data[child]}) : undefined });
this.selectedNode.x0 = width / 8;
......@@ -251,10 +174,6 @@ export class StateManagementComponent implements OnInit {
this.hoveredNode = id;
this.initializePlot();
};
// // Assigns the x and y position for the nodes
// let root;
// const data = this.state.states;
// root = d3.hierarchy(data[1], function(d) { return d.children ? d.children.map(function(child) {return data[child]}) : undefined });
const treeData = this.treemap(root);
......@@ -413,25 +332,5 @@ export class StateManagementComponent implements OnInit {
return path;
}
// function diagonal = d3.linkVertical()
// .x(function(d:any) { return d.y; })
// .y(function(d:any) { return d.x; }));
// for (const state of Object.values(this.state.states)) {
// const trace ={x:[3,9,8,10,4,6,5],y:[5,7,6,7,8,9,8],type:"scatter"};
// const trace1 ={x:[3,4,1,6,8,9,5],y:[4,2,5,2,1,7,3],type:"scatter"};
// const dataa = [trace, trace1];
// const layout = {title : "Simple JavaScript Graph"};
// const gd = await PlotlyJS.newPlot('graph', dataa, layout);
// console.log(gd);
// const plot = d3.select('.cartesianlayer').node();
// console.log(plot);
// this.svg.node().appendChild(plot);
// // const image = await PlotlyJS.toImage(gd,{format: 'svg', height:300,width:300});
// }
}
// Toggle children on click
}
......@@ -275,19 +275,10 @@ export class TableOverviewComponent implements OnInit {
console.log('tables histogram created');
}
// async setQuery(data) {
// this.state.queryWindow = await this.state.getQueryWindow(data[0].y);
// await this.state.update();
// }
public get tables() {
return this.state.lshData.tables;
}
public get visible() {
return !this.state.querySelectionMode;
}
getColor(value) {
const hue=((1-value)*120).toString(10);
return ["hsl(",hue,",100%,50%)"].join("");
......
......@@ -20,98 +20,12 @@
</component>
<component name="ChangeListManager">
<list default="true" id="556080ba-825c-4b55-a92a-867a4df4fb32" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/data/NW_Ground_Stations_2017.csv" afterDir="false" />
<change afterPath="$PROJECT_DIR$/data/NW_Ground_Stations_2018.csv" afterDir="false" />
<change afterPath="$PROJECT_DIR$/data/parameters-240.npy" afterDir="false" />
<change afterPath="$PROJECT_DIR$/data/weather-240.npy" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/api.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/api.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/labeling-window/labeling-window.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/labeling-window/labeling-window.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/main/main.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/main/main.component.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/main/main.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/main/main.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/overview-window/overview-window.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/overview-window/overview-window.component.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/overview-window/overview-window.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/overview-window/overview-window.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/overview-window/overview-window.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/overview-window/overview-window.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/progress-view/progress-view.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/progress-view/progress-view.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/progress-view/progress-view.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/progress-view/progress-view.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/query-window/query-window.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/query-window/query-window.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state-management/state-management.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state-management/state-management.component.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state-management/state-management.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state-management/state-management.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/state.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/table-overview/table-overview.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/table-overview/table-overview.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/settings/settings.component.css" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/settings/settings.component.html" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/settings/settings.component.ts" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/data.pkl" beforeDir="false" afterPath="$PROJECT_DIR$/data/weather.pkl" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/parameters.npy" beforeDir="false" afterPath="$PROJECT_DIR$/data/parameters-120.npy" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/processed-data.npy" beforeDir="false" afterPath="$PROJECT_DIR$/data/processed-data.npy" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/query" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/data/test.bigWig" beforeDir="false" afterPath="$PROJECT_DIR$/data/weather-120.npy" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/preprocessing.py" beforeDir="false" afterPath="$PROJECT_DIR$/preprocessing.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pseudo.py" beforeDir="false" afterPath="$PROJECT_DIR$/pseudo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Compare Recall and Precision on EEG data, M=50.000, T=128, d=20-checkpoint.ipynb" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Compare Recall and Precision on EEG data, M=50.000, T=256, d=70-checkpoint.ipynb" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Compare similarity search strategies MTS on Synthetic data-checkpoint.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Compare similarity search strategies MTS on Synthetic data-checkpoint.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Measure convergence-checkpoint.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Measure convergence-checkpoint.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Results &amp; Graphs-checkpoint.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Results &amp; Graphs-checkpoint.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Test computing time of large time series-checkpoint.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/.ipynb_checkpoints/Test computing time of large time series-checkpoint.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=100.000, T=128, d=35.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=100.000, T=128, d=35.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=25.000, T=128, d=35.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=25.000, T=128, d=35.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=128, d=20.ipynb" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=128, d=35.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=128, d=35.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=256, d=20.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=256, d=20.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=256, d=40.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=256, d=40.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=256, d=60.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=256, d=60.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=50.000, T=256, d=70.ipynb" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=75.000, T=128, d=35.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on EEG data, M=75.000, T=128, d=35.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on Gas Sensor data, T=100, d=16.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on Gas Sensor data, T=100, d=16.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on Gas Sensor data, T=150, d=16.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on Gas Sensor data, T=150, d=16.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on Gas Sensor data, T=200, d=16.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on Gas Sensor data, T=200, d=16.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on Gas Sensor data, T=50, d=16.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare Recall and Precision on Gas Sensor data, T=50, d=16.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare similarity search strategies MTS on Synthetic data.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare similarity search strategies MTS on Synthetic data.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Compare similarity search strategies UTS on PEAX data.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Compare similarity search strategies UTS on PEAX data.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Measure convergence.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Measure convergence.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Results &amp; Graphs.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Results &amp; Graphs.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/Test computing time of large time series.ipynb" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/Test computing time of large time series.ipynb" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_100000_128_35.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_100000_128_35.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_25000_128_35.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_25000_128_35.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_50000_128_35.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_50000_128_35.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_50000_256_20.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_50000_256_20.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_50000_256_40.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_50000_256_40.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_50000_256_60.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_50000_256_60.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_75000_128_35.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_eeg_75000_128_35.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_gas_200000_100_16.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_gas_200000_100_16.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_gas_200000_150_16.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_gas_200000_150_16.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_gas_200000_200_16.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_gas_200000_200_16.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_gas_200000_50_16.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_gas_200000_50_16.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/accuracy_synthetic.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/accuracy_synthetic.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_0.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_0.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_1.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_1.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_2.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_2.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_3.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_3.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_4.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_4.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_examples_0.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_examples_0.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_examples_1.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_examples_1.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_examples_2.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_examples_2.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_examples_3.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_examples_3.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/convergence_examples_4.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/convergence_examples_4.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/query_computing_time.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/query_computing_time.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/query_performance.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/query_performance.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/sample_computing_time.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/sample_computing_time.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/sample_performance.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/sample_performance.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_eeg_100000_128_35.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_eeg_100000_128_35.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_eeg_25000_128_35.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_eeg_25000_128_35.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_eeg_50000_128_35.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_eeg_50000_128_35.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_eeg_50000_256_20.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_eeg_50000_256_20.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_eeg_50000_256_40.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_eeg_50000_256_40.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_eeg_50000_256_60.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_eeg_50000_256_60.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_eeg_75000_128_35.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_eeg_75000_128_35.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_gas_200000_100_16.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_gas_200000_100_16.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_gas_200000_150_16.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_gas_200000_150_16.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_gas_200000_200_16.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_gas_200000_200_16.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/time_gas_200000_50_16.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/time_gas_200000_50_16.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/track_computing_time.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/track_computing_time.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/track_performance.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/track_performance.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/images/visual_similarity_time_complexity.png" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/images/visual_similarity_time_complexity.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../experiments/results.json" beforeDir="false" afterPath="$PROJECT_DIR$/../experiments/results.json" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......
......@@ -97,6 +97,17 @@ def initialize():
print('LSH done: ' + str(time()-t0))
return response
"""
Calculates LSH parameters based on the dataset
Input: {
windowsize: int
}
Output: {
parameters: 1d array [3]
}
"""
@app.route('/get-lsh-parameters', methods=['POST'])
def get_lsh_parameters():
t0 = time()
......
......@@ -103,12 +103,14 @@ def preprocess(data, r=None):
subset = []
t0 = time()
if r is None:
r = 23.25 # data.shape[2]
r = data.shape[2]
started = False
first = 0
last = r * 2
i = 0
print("r = " + str(r))
# Use binary search to find optimal parameters (added simple constraints to speed up)
while True:
state = 1
for s in subset:
......@@ -141,8 +143,6 @@ def preprocess(data, r=None):
elif (i == len(data)):
break
# subset = sample(list(range(len(data))), 200)
dtw_distances = []
eq_distances = []
for i, index_1 in enumerate(subset):
......@@ -241,7 +241,6 @@ def table_info(data, table):
'max': max_values.tolist(),
'min': min_values.tolist()
})
# distances = [[dtw(np.array(v["average"]), np.array(w["average"]), global_constraint='sakoe_chiba', sakoe_chiba_radius=int(0.05 * 120)) for j, w in enumerate(prototypes)] for i, v in enumerate(prototypes)]
return {'prototypes': prototypes, 'distances': []}
def query(data, window_indices):
......
......@@ -123,10 +123,6 @@ static PyObject* lsh_lsh(PyObject* self, PyObject* args) {
printf("Number of candidates: %d\n", nrOfCandidates);
npy_intp dims4[4] = {L, K, channel_size};
// PyArrayObject* numpy_candidates = (PyArrayObject*)PyArray_SimpleNewFromData(1, dimscandidates, NPY_INT, (void*)&candidates);
// PyArrayObject* numpy_distances = (PyArrayObject*)PyArray_SimpleNewFromData(1, dimsdistance, NPY_DOUBLE, (void*)&distances);
// https://github.com/suiyun0234/scipy-master/commit/da7dfc7aad8daa7a516e43f4c7001eea7c1a707e
// https://github.com/fjean/pymeanshift/commit/1ba90da647342184ea7df378d7f21eba257a51d9
PyArrayObject* numpy_candidates = (PyArrayObject*)PyArray_SimpleNew(3, dimscandidates, NPY_INT);
int* numpy_candidates_data = (int*)PyArray_DATA(numpy_candidates);
for (int l=0;l<L;l++)
......@@ -160,32 +156,5 @@ static PyObject* lsh_lsh(PyObject* self, PyObject* args) {
}
}
PyObject* ret = Py_BuildValue("NNN", PyArray_Return(numpy_candidates), PyArray_Return(numpy_distances), PyArray_Return(numpy_hash_functions));
// Py_XDECREF(data_obj);
// Py_XDECREF(query_obj);
// Py_XDECREF(hash_obj);
// Py_XDECREF(weights);
// Py_XDECREF(data);
// Py_XDECREF(query);
// Py_XDECREF(descr);
// Py_XDECREF(descr_float);
// Py_XDECREF(query);
// Py_XDECREF(numpy_candidates);
// Py_XDECREF(numpy_distances);
// Py_XDECREF(TEST);
// free(candidates);
// free(distances);
// for (int l=0;l<L;l++)
// {
// for (int k=0;k<K;k++)
// {
// for (int t=0;t<query_size;t++)
// {
// free(hashFunctions[l][k][t]);
// }
// free(hashFunctions[l][k]);
// }
// free(hashFunctions[l]);
// }
// free(hashFunctions);
return ret;
}
#include <Python.h>
#include <numpy/arrayobject.h>
#include "ucrdtw.h"
/* Docstrings */
static char module_docstring[] = "This module implements fast nearest-neighbor retrieval under the dynamic time warping (DTW).";
static char ucrdtw_docstring[] = "Calculate the nearest neighbor of a times series in a larger time series expressed as location and distance, "
"using the UCR suite optimizations.";
/* Available functions */
static PyObject* ucrdtw_ucrdtw(PyObject *self, PyObject *args);
/* Module specification */
static PyMethodDef module_methods[] = { { "ucrdtw", ucrdtw_ucrdtw, METH_VARARGS, ucrdtw_docstring }, { NULL, NULL, 0, NULL } };
/* Initialize the module */
#if PY_MAJOR_VERSION >= 3
#define MOD_ERROR_VAL NULL
#define MOD_SUCCESS_VAL(val) val
#define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)
#define MOD_DEF(ob, name, doc, methods) \
static struct PyModuleDef moduledef = { \
PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \
ob = PyModule_Create(&moduledef);
#else
#define MOD_ERROR_VAL
#define MOD_SUCCESS_VAL(val)
#define MOD_INIT(name) void init##name(void)
#define MOD_DEF(ob, name, doc, methods) \
ob = Py_InitModule3(name, methods, doc);
#endif
MOD_INIT(_ucrdtw)
{
PyObject *m;
MOD_DEF(m, "_ucrdtw", module_docstring,
module_methods)
if (m == NULL)
return MOD_ERROR_VAL;
import_array();
return MOD_SUCCESS_VAL(m);
}
/*
Calculate the nearest neighbor of a times series in a larger time series expressed as location and distance,
using the UCR suite optimizations.
Arguments:
data - a list of floats or an ndarray for the time series to process
query - a list of floats or an ndarray for the time series to search for
warp_width - Allowed warp width as a fraction of query size
verbose - Optional boolean to print stats
*/
static PyObject* ucrdtw_ucrdtw(PyObject* self, PyObject* args) {
PyObject* data_obj = NULL;
PyObject* query_obj = NULL;
double warp_width = -1;
PyObject* verbose_obj = NULL;
/* Parse the input tuple */
if (!PyArg_ParseTuple(args, "OOd|O", &data_obj, &query_obj, &warp_width, &verbose_obj)) {
return NULL;
}
/* Interpret the input objects as numpy arrays. */
if (!PyList_Check(data_obj) && !PyArray_Check(data_obj)) {
PyErr_SetString(PyExc_TypeError, "Data argument must be a list or ndarray");
return NULL;
}
// PyObject* data_array = PyArray_FROM_OTF(data_obj, NPY_DOUBLE, NPY_ARRAY_IN_ARRAY);
// if (data_array == NULL) {
// Py_XDECREF(data_array);
// PyErr_SetString(PyExc_TypeError, "Data argument must be a list or ndarray");
// return NULL;
// }
double** data;