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

Sampled windows as MTS data

parent 97a23c50
......@@ -2,6 +2,7 @@
margin-right: 20px;
display: flex;
justify-content: center;
border-right: groove;
}
.subplot-container {
......
......@@ -78,45 +78,66 @@ export class LabelingWindowComponent implements OnInit {
}
}
this.topk = topk;
this.subplots = [];
for (const window of this.topk) {
this.subplots.push(
{
index: window.index,
data: [{
x: [...Array(this.service.windowSize).keys()],
y: this.service.rawValues[0].slice(window.index, window.index + this.service.windowSize),
type: 'line'
}],
layout: {
title: `Index: ${window.index.toString()} Similarity: ${window.frequency.toString()}%`,
hovermode: 'closest',
autosize: true,
margin: {
l: 30,
r: 30,
t: 30,
b: 0,
pad: 4
},
height: 150,
width: 150,
titlefont: {
size: 9
},
xaxis: {
showgrid: false,
zeroline: false,
showticklabels: false,
},
yaxis: {
zeroline: false,
showticklabels: false,
}
for (const windowIndex of this.topk) {
const window = this.service.rawValues.map((channel) => channel.slice(windowIndex.index, windowIndex.index + this.service.windowSize));
const data = [];
window.forEach((channel, index) => {
data.push({
x: [...Array(channel.length).keys()],
y: channel,
type: 'line',
xaxis: 'x',
yaxis: `y${index + 2}`,
});
});
const subplots = [];
window.forEach((channel, index) => {
subplots.push([`xy${index + 2}`]);
});
const plot = {
index: windowIndex.index,
data: data,
layout: {
grid: {
rows: this.service.queryWindow.length,
columns: 1,
subplots: subplots,
},
showlegend: false,
title: `Index: ${windowIndex.index.toString()} Similarity: ${windowIndex.frequency.toString()}%`,
hovermode: 'closest',
autosize: true,
margin: {
l: 30,
r: 30,
t: 30,
b: 0,
pad: 4
},
height: 300,
width: 150,
titlefont: {
size: 9
},
xaxis: {
showgrid: false,
zeroline: false,
showticklabels: false,
},
yaxis: {
zeroline: false,
showticklabels: false,
}
}
);
};
window.forEach((channel, index) => {
plot.layout[`yaxis${index + 2}`] = {
zeroline: false,
showticklabels: false,
};
});
this.subplots.push(plot);
}
}
}
......@@ -73,7 +73,7 @@ export class OverviewWindowComponent implements OnInit {
marker: {
backgroundColor: '#4caf50'
},
zIndex: 20,
zIndex: 3,
},
{
type: 'scatter',
......@@ -82,7 +82,7 @@ export class OverviewWindowComponent implements OnInit {
marker: {
backgroundColor: '#f44336'
},
zIndex: 20,
zIndex: 2,
},
{
type: 'scatter',
......@@ -91,7 +91,7 @@ export class OverviewWindowComponent implements OnInit {
marker: {
backgroundColor: '#b1a343'
},
zIndex: 20,
zIndex: 1,
}
]
});
......@@ -189,7 +189,7 @@ export class OverviewWindowComponent implements OnInit {
backgroundColor: "#4caf50",
});
} else {
this.badLabels.push([Number(index), 0]);
this.badLabels.push([Number(index), -1]);
this.markers.push({
type: 'area',
// BUG: For some reason the range values are multiplied by 10
......@@ -204,6 +204,7 @@ export class OverviewWindowComponent implements OnInit {
} else {
channel.series[0].values = this.goodLabels;
channel.series[1].values = this.badLabels;
channel.series[2].values = [];
}
}
this.chart.setdata({
......@@ -221,7 +222,7 @@ export class OverviewWindowComponent implements OnInit {
const labels = [];
const markers = [];
for (const index of candidates) {
labels.push([Number(index), 0]);
labels.push([Number(index), 1]);
markers.push({
type: 'area',
// BUG: For some reason the range values are multiplied by 10
......@@ -231,10 +232,9 @@ export class OverviewWindowComponent implements OnInit {
}
for (const channel of this.config.graphset) {
if (channel.type === 'line') {
channel.scaleX.markers = this.markers;
channel.scaleX.markers = channel.scaleX.markers.concat(markers);
} else {
channel.series[0].values = this.goodLabels;
channel.series[1].values = this.badLabels;
channel.series[2].values = labels;
}
}
this.chart.setdata({
......
......@@ -139,6 +139,6 @@ export class ProgressViewComponent implements OnInit {
}
public get amountOfCandidates() {
return 1; // this.similarity[this._sliderValue.toString()].length;
return this.similarity[this._sliderValue.toString()].length;
}
}
......@@ -53,7 +53,7 @@ export class QueryWindowComponent implements OnInit {
b: 5,
pad: 4
},
height: 150,
height: 300,
width: 150,
titlefont: {
size: 9
......
......@@ -105,7 +105,7 @@ export class TableOverviewComponent implements OnInit {
return this.distanceMetric(hash1) - this.distanceMetric(hash2);
});
if (this.service.queryWindow) {
const queryEntry = this.calculateSignature(table.hash, this.service.queryWindow);
const queryEntry = this.calculateSignature(table.hash, this.service.queryWindow[0]);
listOfWindows.push(table.entries[queryEntry]);
opacity = orderedHashes.map((hash: string) => {
return hash === queryEntry ? 1.0 : 0.5;
......
......@@ -3,7 +3,6 @@
<component name="ChangeListManager">
<list default="true" id="556080ba-825c-4b55-a92a-867a4df4fb32" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/processed-data.npy" beforeDir="false" afterPath="$PROJECT_DIR$/processed-data.npy" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
......@@ -16,8 +15,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="199" column="31" lean-forward="true" selection-start-line="199" selection-start-column="31" selection-end-line="199" selection-end-column="31" />
<state relative-caret-position="-59">
<caret line="275" column="38" lean-forward="true" selection-start-line="275" selection-start-column="38" selection-end-line="275" selection-end-column="38" />
<folding>
<element signature="e#0#41#0" expanded="true" />
</folding>
......@@ -58,9 +57,9 @@
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="-11" />
<option name="y" value="-11" />
<component name="ProjectFrameBounds" extendedState="7">
<option name="x" value="-12" />
<option name="y" value="-12" />
<option name="width" value="1890" />
<option name="height" value="960" />
</component>
......@@ -70,7 +69,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -82,6 +80,7 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -144,17 +143,18 @@
<workItem from="1599578907139" duration="8436000" />
<workItem from="1599661275060" duration="1249000" />
<workItem from="1600001984238" duration="16778000" />
<workItem from="1600348467353" duration="2026000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="110834000" />
<option name="totallyTimeSpent" value="112860000" />
</component>
<component name="ToolWindowManager">
<frame x="-7" y="-7" width="1295" height="695" extended-state="6" />
<frame x="-7" y="-7" width="1295" height="695" extended-state="7" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.28698465" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2918351" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
......@@ -210,8 +210,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="199" column="31" lean-forward="true" selection-start-line="199" selection-start-column="31" selection-end-line="199" selection-end-column="31" />
<state relative-caret-position="-59">
<caret line="275" column="38" lean-forward="true" selection-start-line="275" selection-start-column="38" selection-end-line="275" selection-end-column="38" />
<folding>
<element signature="e#0#41#0" expanded="true" />
</folding>
......
......@@ -126,7 +126,6 @@ def create_tables():
window_size = int(raw_data['parameters']["windowsize"])
hash_size = int(raw_data['parameters']["hashsize"])
table_size = int(raw_data['parameters']["tablesize"])
data = np.array(data)
print('Starting: ' + str(time()-t0))
tables_hash_function = [np.random.uniform(-1, 1, size=(window_size, hash_size)) for _ in range(table_size)]
print('Init time: ' + str(time() - t0))
......@@ -235,7 +234,7 @@ def average_progress():
print("Initialized: " + str(time() - t0))
for windows in all_windows:
t1 = time()
actual_windows.extend(data[windows])
actual_windows.extend([item[0] for item in data[windows]])
if len(actual_windows) == 0:
output.append([])
continue
......@@ -262,7 +261,7 @@ def average_table():
print("Initialized: " + str(time() - t0))
for windows in all_windows:
t1 = time()
actual_windows = data[windows]
actual_windows = [item[0] for item in data[windows]]
print(len(actual_windows))
average_values = np.average(actual_windows, 0)
# average_values = (np.sum(actual_windows, 0) / len(actual_windows))
......@@ -303,7 +302,8 @@ def update():
print("Initialized: " + str(time() - t0))
for t in tables.values():
valid = True
signature = ''.join((np.dot(window, t["hash"]) > 0).astype('int').astype('str'))
signature_bool = np.dot([1, 1, 1], np.dot(window, t["hash"])) > 0
signature = ''.join(['1' if x else '0' for x in signature_bool])
neighbours = t["entries"][signature]
for index in correct_indices:
if index not in neighbours:
......@@ -321,7 +321,7 @@ def update():
t1 = time()
while True:
hash_function = np.random.randn(window_size, hash_size)
correct_signatures = [''.join((np.dot(data[i], hash_function) > 0).astype('int').astype('str')) for
correct_signatures = [''.join(np.dot([1, 1, 1], (np.dot(data[i], hash_function) > 0)).astype('int').astype('str')) for
i in
correct_indices]
incorrect_signatures = [''.join((np.dot(data[i], hash_function) > 0).astype('int').astype('str')) for
......@@ -333,7 +333,7 @@ def update():
break
print("first: " + str(time() - t1))
t2 = time()
signatures_bool = np.dot(data, hash_function) > 0
signatures_bool = np.dot([1, 1, 1], np.dot(data, hash_function)) > 0
signatures = [''.join(['1' if x else '0' for x in lst]) for lst in signatures_bool]
for i in range(len(signatures)):
entries[signatures[i]].append(i)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment