dani2112 commited on
Commit
65d6c20
·
1 Parent(s): ea2e2ed
Files changed (5) hide show
  1. .gitattributes +2 -0
  2. Dockerfile +13 -0
  3. df.json +3 -0
  4. issues.json +3 -0
  5. run.py +50 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ df.json filter=lfs diff=lfs merge=lfs -text
37
+ issues.json filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ WORKDIR /code
4
+ ENV HOME=/code
5
+
6
+ RUN pip install pip -U
7
+
8
+ RUN pip install renumics-spotlight==1.3.0
9
+
10
+ COPY . .
11
+ COPY image/ .
12
+ RUN chmod -R 777 /code
13
+ CMD ["python", "run.py"]
df.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab769cff7e24089bfa5c126d88b3e582b490c9d30f2122f7a9bd699381d96ab1
3
+ size 2124164
issues.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0b6d1d9468b412057cb9a7fdab4f5df3eca880b98f25ab3467e703e2a548ebd
3
+ size 39848
run.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import numpy as np
3
+ from renumics import spotlight
4
+ from renumics.spotlight.analysis.typing import DataIssue
5
+
6
+
7
+ if __name__ == "__main__":
8
+ df = pd.read_json("df.json")
9
+ # df[
10
+ # "GitHub"
11
+ # ] = '<a href="https://github.com/Renumics/spotlight" target="_blank">⭐ Check Out Spotlight on GitHub</a>'
12
+
13
+ issues = pd.read_json("issues.json")
14
+
15
+ spotlight_issues = []
16
+ for _, issue in issues.sort_values("metric").iterrows():
17
+ issue_metric = issue["metric"]
18
+ issue_title = f"{issue_metric:.2f} -> " + issue["explanation"]
19
+
20
+ predicate_strings = [
21
+ f"{x['minimum']:.1f} < {x['column']} < {x['maximum']:.1f}"
22
+ for x in issue["predicates"]
23
+ if ("minimum" in x and "maximum" in x)
24
+ ]
25
+ issue_explanation = "; ".join(predicate_strings)
26
+
27
+ data_issue = DataIssue(
28
+ severity="medium",
29
+ title=issue_title,
30
+ description=issue_explanation,
31
+ rows=issue["rows"],
32
+ columns=[x["column"] for x in issue["predicates"]],
33
+ )
34
+ spotlight_issues.append(data_issue)
35
+
36
+ while True:
37
+ dtypes = {
38
+ "sg_projection": spotlight.Embedding,
39
+ }
40
+ view = spotlight.show(
41
+ df,
42
+ dtype=dtypes,
43
+ port=7860,
44
+ host="0.0.0.0",
45
+ allow_filebrowsing=False,
46
+ issues=spotlight_issues,
47
+ # layout="spotlight-layout.json",
48
+ )
49
+
50
+ view.close()