2023-03-15: checked it for python == 3.11, django == 4.1.7, jupyterlab = 3.6.1, django-extensions == 3.2.1, jupyter-server <= 2.0.0
Using Django project in Jupyter or JupyterLab
2023-03-15: checked it for python == 3.11, django == 4.1.7, jupyterlab = 3.6.1, django-extensions == 3.2.1, jupyter-server <= 2.0.0
Using Django project in Jupyter or JupyterLab
# Using Jupyter with Django | |
# Requires django_extensions | |
# For all settings see jupyter --help-all | |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
try: | |
import jupyterlab | |
notebook_default_url = '/lab' # Using JupyterLab | |
except ImportError: | |
notebook_default_url = '/tree' # Using Jupyter |
# Euclidean distance. | |
def euc_dist(pt1,pt2): | |
return math.sqrt((pt2[0]-pt1[0])*(pt2[0]-pt1[0])+(pt2[1]-pt1[1])*(pt2[1]-pt1[1])) | |
def _c(ca,i,j,P,Q): | |
if ca[i,j] > -1: | |
return ca[i,j] | |
elif i == 0 and j == 0: | |
ca[i,j] = euc_dist(P[0],Q[0]) | |
elif i > 0 and j == 0: |
Привет, дорогой друг!
Если ты здесь, то видимо ты обучаешься на курсе Data Mining in Action. Должно быть ты уже заметили, что материалы курса выкладываются в этом репозитории. Сейчас я расскажу тебе один из способов, как всегда иметь под рукой его свежую версию.
Если какие-то шаги уже выполнены, просто пропусти их.
Чтобы получить себе копию репозитория курса, нужно сделать fork исходного репозитория
Теперь клонируем репозиторий к себе на компьютер, выполнив в консоли команду:
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" |
import numpy as np | |
from itertools import chain | |
intervals_a=[(0, 3), (5, 8), (11, 12), (14, 15)] | |
intervals_b=[(1, 2), (4, 6), (7, 9), (10, 13), (14, 15)] | |
def intersect_intervals(intervals_a, intervals_b): | |
# Create events like | |
# [[<point_a_0>, <open_a>, <miss_b>], [<point_a_1>, <close_a>, <miss_b>], ...] | |
# and [[<point_b_0>, <miss_a>, <open_b>], [<point_b_1>, <miss_a>, <close_b>], ...] |