Skip to content

Commit ae9af61

Browse files
committed
Add Python3 server and fix import issue in tutorial
1 parent 39624e7 commit ae9af61

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

docs/notebooks/3_indepth_tutorial.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@
319319
"cell_type": "markdown",
320320
"metadata": {},
321321
"source": [
322-
"In this case, we can see that AIC and BIC both chose the `GaussianModel` with degree 9 and variance 0.1 as the best model. This is a very reasonable selection since the synthetic handwriting data is actually generated from a `GaussianModel` with 8 functions and 0.1 variance (see `create_2d_handwriting_data` in `temporal_robustness.py`). Note that the selection is influenced by the noise in the data as well as the model noise used by Selection when calculating the log-likelihood (by default that is set to 0.05).\n",
322+
"In this case, we can see that AIC and BIC both chose the `GaussianModel` with degree 9 and variance 0.1 as the best model. This is a very reasonable selection since the synthetic handwriting data is actually generated from a `GaussianModel` with 8 functions and 0.1 variance (see `create_2d_handwriting_data` in `examples/tutorial.py`). Note that the selection is influenced by the noise in the data as well as the model noise used by Selection when calculating the log-likelihood (by default that is set to 0.05).\n",
323323
"\n",
324324
"### Utilizing multiple basis spaces\n",
325325
"\n",

intprim/examples/tutorial.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import copy
22
import intprim
3-
import IPython.display
43
import matplotlib.pyplot as plt
54
import matplotlib.animation
65
import numpy as np
76
import numpy.random
87
import sklearn.metrics
98

9+
try:
10+
import IPython.display
11+
except:
12+
pass
13+
1014
animation_plots = []
1115

1216
def create_2d_handwriting_data(num_trajectories, translation_mean, translation_std, noise_std, length_mean, length_std):
@@ -198,3 +202,4 @@ def evaluate_trajectories(primitive, filter, test_trajectories, observation_nois
198202
print("Mean DoF MSE: " + str(mean_mse / mse_count) + ". Phase MAE: " + str(phase_mae / mse_count))
199203

200204
# animate_results(all_gen_trajectories, all_test_trajectories, mean_trajectory)
205+
File renamed without changes.

intprim/util/server3.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from http.server import HTTPServer, SimpleHTTPRequestHandler, test
2+
3+
import sys
4+
5+
class CORSRequestHandler (SimpleHTTPRequestHandler):
6+
def end_headers (self):
7+
self.send_header('Access-Control-Allow-Origin', '*')
8+
SimpleHTTPRequestHandler.end_headers(self)
9+
10+
if __name__ == '__main__':
11+
test(CORSRequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000, bind = "127.0.0.1")

0 commit comments

Comments
 (0)