Skip to content

Commit 2210542

Browse files
committed
Library now works in jupyter on cloud
1 parent b3628a1 commit 2210542

28 files changed

+101
-11
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ Import **explainx**
6161
from explainx import *
6262
```
6363

64+
Runnning **explainx** for the first time? Run this function.
65+
66+
```python
67+
explainx.run_only_first_time()
68+
```
69+
6470
Load dataset as X_Data, Y_Data in your XGBoost Model
6571

6672
```python

__pycache__/__init__.cpython-37.pyc

-213 Bytes
Binary file not shown.

__pycache__/explain.cpython-37.pyc

-3.13 KB
Binary file not shown.

explain.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import os
22
import sys
33
from pathlib import Path
4-
4+
from sys import platform
5+
import subprocess
56

67
path= Path(__file__).parent.absolute()
78
path_dataset= os.path.join(path, "datasets")
@@ -149,11 +150,42 @@ def dataset_heloc(self):
149150
return X,y
150151

151152

153+
def run_only_first_time(self):
154+
155+
if platform == "linux" or platform == "linux2":
156+
try:
157+
run_command("sudo apt install nodejs")
158+
run_command("sudo apt install npm")
159+
except:
160+
run_command("sudo yum install nodejs")
161+
run_command("sudo yum install npm")
162+
run_command("npm install -g localtunnel")
163+
164+
elif platform == "darwin":
165+
run_command("xcode-select --install")
166+
run_command("brew install nodejs")
167+
run_command("npm install -g localtunnel")
152168

169+
elif platform == "win32":
170+
print("Please install nodejs, npm, and localtunnel manually")
171+
run_command("npm install -g localtunnel")
172+
elif platform == "win64":
173+
print("Please install nodejs, npm, and localtunnel manually")
174+
run_command("npm install -g localtunnel")
153175

154176

155177
explainx=explain()
156178

157179

180+
def run_command(command):
181+
# subdomain= 'explainx-'+ get_random_string(10)
182+
command_arr = command.split(" ")
183+
184+
task = subprocess.Popen(command_arr,
185+
stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid)
186+
187+
for line in iter(task.stdout.readline, b''):
188+
print('{0}'.format(line.decode('utf-8')), end='')
189+
158190

159191

lib/__pycache__/PDASH.cpython-37.pyc

-2.2 KB
Binary file not shown.
-6.45 KB
Binary file not shown.
-184 Bytes
Binary file not shown.
-5.41 KB
Binary file not shown.
-21.6 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)