Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
360db10
Change imgur images links to Google hosted
ryanholbrook Jan 3, 2023
66a802a
removing pyearth from ex2, ex5
alexisbcook Apr 11, 2023
b7efcb8
fixing scikit learn
alexisbcook Apr 11, 2023
d36eab8
fixing multiindex
alexisbcook Apr 12, 2023
d87fe76
scikit learn error
alexisbcook Apr 12, 2023
af90678
feature engineering -- criterion
alexisbcook Apr 12, 2023
1590f91
ronehot encoding no longer removes column names
alexisbcook Apr 14, 2023
4133418
amending tutorial to be consistent with exercise
alexisbcook Apr 14, 2023
03bb363
tut3, ex3 changes to ml_intermediate
alexisbcook Apr 14, 2023
509f6ea
changing to string columns
alexisbcook Apr 14, 2023
3f39748
intermediate ml exercise 6 checking if model fit
alexisbcook Apr 14, 2023
1e3d604
Update ex_0.ipynb
alexisbcook Apr 15, 2023
124fc28
display.maxrows
alexisbcook Apr 16, 2023
2f21084
Merge pull request #445 from Kaggle/remove-pyearth
alexisbcook Apr 18, 2023
16bc0af
Merge branch 'master' into image-hosting
alexisbcook Apr 20, 2023
ab3f19a
Merge pull request #433 from Kaggle/image-hosting
alexisbcook Apr 20, 2023
7dc387e
[Game AI] install stable-baselines3 from repo
alexisbcook May 22, 2023
11f07cc
Merge pull request #446 from Kaggle/alexisbcook-patch-6
alexisbcook May 22, 2023
557d62f
[Game AI] also need to update tutorial
alexisbcook May 22, 2023
69bc6da
Merge pull request #447 from Kaggle/alexisbcook-patch-7
alexisbcook May 22, 2023
74afd85
Update timeout to avoid build failures.
jplotts Jun 21, 2023
3f8b29f
Merge pull request #450 from Kaggle/tutorial-timeout
jplotts Jun 21, 2023
1a67b73
Fix image links
bobfraser-google Jun 30, 2023
663c615
Merge pull request #451 from Kaggle/intro2programming
bobfraser-google Jun 30, 2023
93cf102
Fix broken image link
ryanholbrook Jul 21, 2023
12ca900
Remove slack notifications
rosbo Aug 22, 2023
d91bb24
Merge pull request #453 from Kaggle/rm-slack-commands
rosbo Aug 22, 2023
8bfca82
Fix utils#plot_periodogram
rosbo Aug 29, 2023
7aeb510
more fixes
rosbo Aug 29, 2023
8e355c7
more fixes
rosbo Aug 29, 2023
05f5702
Fix feature_engineering_new track
rosbo Aug 29, 2023
55574bf
Merge pull request #454 from Kaggle/fix-pandas-time-series-deprecation
rosbo Aug 30, 2023
efd47d3
Migrate seaborn-whitegrid to seaborn-v0_8-whitegrid
djherbis Sep 27, 2023
7a83948
Merge pull request #455 from Kaggle/fix-seaborn-whitegrid
djherbis Sep 27, 2023
36c72e9
change table to match updated dataset
mcbex Jan 10, 2024
3332b19
update exercise
mcbex Jan 10, 2024
336be2b
update tutorial and add comment about quoting reserved words
mcbex Jan 10, 2024
3a07d14
Merge pull request #458 from mcbex/sql-ex3-fixes
pculliton Jan 22, 2024
5fe9ba7
Update push documentation.
jplotts Jan 24, 2024
5f27cee
Merge pull request #459 from Kaggle/doc-update
jplotts Jan 25, 2024
9e54093
Add more pushing documentation.
jplotts Jan 30, 2024
0b91589
Merge pull request #460 from Kaggle/more-doc-updates
jplotts Jan 30, 2024
c3b0c70
Added exemption due to keras upgrade
calderjo Feb 9, 2024
9a53ec1
reviewer feedback pt1
calderjo Feb 9, 2024
940f894
Merge pull request #462 from Kaggle/update-test-keras3
calderjo Feb 9, 2024
9c70809
Enable kernels to be pinned to the original docker image
jplotts Feb 21, 2024
183cdad
Merge pull request #463 from Kaggle/do-not-unpin
jplotts Feb 21, 2024
9ab6e7a
fix test suite
calderjo Mar 14, 2024
ca2a51e
Merge pull request #466 from Kaggle/fix-test-suite
calderjo Mar 18, 2024
cad89a2
Use regular docker runtime runc
djherbis Nov 29, 2024
4e63344
Update ex5.py
JohnM-TX Dec 26, 2024
7cedc18
Update ex6.py
JohnM-TX Dec 26, 2024
5ce0635
Update ex1.py
JohnM-TX Dec 26, 2024
62fda47
fix bug in Update ex1.py
JohnM-TX Dec 26, 2024
31e1dc4
Update ex1.py
JohnM-TX Dec 26, 2024
e902f9f
Update ex1.py
JohnM-TX Dec 26, 2024
16b6934
Update ex2.py
JohnM-TX Dec 26, 2024
87e2c04
Update ex2.py
JohnM-TX Dec 26, 2024
96e9049
Update ex5.py
JohnM-TX Dec 28, 2024
1d7f217
Update ex6.py
JohnM-TX Dec 28, 2024
5fc37f8
Update ex5.py
JohnM-TX Dec 30, 2024
167e81d
Update ex6.py
JohnM-TX Dec 30, 2024
6d0b000
Update ex1.py
JohnM-TX Dec 30, 2024
8132ca6
Update ex2.py
JohnM-TX Dec 30, 2024
010e3b5
Merge pull request #475 from JohnM-TX/sql-fix/jpm
jplotts Jan 7, 2025
7c0888b
Rough implementation using kagglesdk
jplotts Mar 27, 2025
9188caf
Merge pull request #478 from Kaggle/using-kagglesdk
jplotts Mar 28, 2025
b00a2aa
Sort the results before comparison
jplotts May 27, 2025
003526b
Merge pull request #480 from Kaggle/fix-ordering-sql-ex
jplotts May 27, 2025
a3752b6
Use the `KAGGLE_LEARN_SESSION_ID`
jplotts Jul 1, 2025
58d1c06
Merge pull request #481 from Kaggle/use-env-var
jplotts Jul 2, 2025
a8e9772
Post response back to the outer iframe.
jplotts Jul 17, 2025
3f4775a
Fix comment
jplotts Jul 18, 2025
2bd9089
More comment formatting
jplotts Jul 18, 2025
8ee90fc
Merge pull request #482 from Kaggle/post-nudges
jplotts Jul 18, 2025
14475cf
Cast KAGGLE_LEARN_SESSION_ID to int
jplotts Jul 24, 2025
a0c08ac
Merge pull request #483 from Kaggle/fix-session-id
jplotts Jul 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pipeline {
GIT_COMMIT_SUBJECT = sh(returnStdout: true, script:"git log --format=%s -n 1 HEAD").trim()
GIT_COMMIT_AUTHOR = sh(returnStdout: true, script:"git log --format='%an' -n 1 HEAD").trim()
GIT_COMMIT_SUMMARY = "`<https://github.com/Kaggle/learntools/commit/${GIT_COMMIT}|${GIT_COMMIT_SHORT}>` ${GIT_COMMIT_SUBJECT} - ${GIT_COMMIT_AUTHOR}"
SLACK_CHANNEL = "#learnops"
MATTERMOST_CHANNEL = "#learnops"
KAGGLE_KEY = credentials('KAGGLE_API_KEY')
KAGGLE_USERNAME = 'dansbecker'
}
Expand All @@ -18,8 +18,9 @@ pipeline {
steps {
sh '''#!/bin/bash
set -exo pipefail
# Ensures the currently released Docker Python image is used.
# Ensures both pinned and unpinned notebook are supported
docker pull gcr.io/kaggle-images/python:staging
docker pull gcr.io/kaggle-images/python:v143
'''
}
}
Expand All @@ -35,16 +36,13 @@ pipeline {

post {
failure {
slackSend color: 'danger', message: "*<${env.BUILD_URL}console|${JOB_NAME} failed>* ${GIT_COMMIT_SUMMARY}", channel: env.SLACK_CHANNEL
mattermostSend color: 'danger', message: "*<${env.BUILD_URL}console|${JOB_NAME} failed>* ${GIT_COMMIT_SUMMARY} @kernels-backend-ops", channel: env.SLACK_CHANNEL
mattermostSend color: 'danger', message: "*<${env.BUILD_URL}console|${JOB_NAME} failed>* ${GIT_COMMIT_SUMMARY} @kernels-backend-ops", channel: env.MATTERMOST_CHANNEL
}
success {
slackSend color: 'good', message: "*<${env.BUILD_URL}console|${JOB_NAME} passed>* ${GIT_COMMIT_SUMMARY}", channel: env.SLACK_CHANNEL
mattermostSend color: 'good', message: "*<${env.BUILD_URL}console|${JOB_NAME} passed>* ${GIT_COMMIT_SUMMARY} @kernels-backend-ops", channel: env.SLACK_CHANNEL
mattermostSend color: 'good', message: "*<${env.BUILD_URL}console|${JOB_NAME} passed>* ${GIT_COMMIT_SUMMARY} @kernels-backend-ops", channel: env.MATTERMOST_CHANNEL
}
aborted {
slackSend color: 'warning', message: "*<${env.BUILD_URL}console|${JOB_NAME} aborted>* ${GIT_COMMIT_SUMMARY}", channel: env.SLACK_CHANNEL
mattermostSend color: 'warning', message: "*<${env.BUILD_URL}console|${JOB_NAME} aborted>* ${GIT_COMMIT_SUMMARY} @kernels-backend-ops", channel: env.SLACK_CHANNEL
mattermostSend color: 'warning', message: "*<${env.BUILD_URL}console|${JOB_NAME} aborted>* ${GIT_COMMIT_SUMMARY} @kernels-backend-ops", channel: env.MATTERMOST_CHANNEL
}
}
}
2 changes: 1 addition & 1 deletion learntools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
machine_learning, ml_explainability, ml_insights, ml_intermediate, python, \
sql

__version__ = '0.3.4'
__version__ = '0.3.5'
81 changes: 79 additions & 2 deletions learntools/core/tracking.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import enum
from IPython.display import display, Javascript
import json

import learntools
import os

# If set to True, then echo logged events as output.
DEBUG = False

USE_KAGGLESDK = os.environ.get('LEARN_USE_KAGGLE_SDK') == 'True'
if USE_KAGGLESDK:
from kagglesdk import KaggleClient
from kagglesdk.education.types.education_api_service import ApiTrackExerciseInteractionRequest
from kagglesdk.education.types.education_service import LearnExerciseInteractionType, LearnExerciseOutcomeType, LearnExerciseQuestionType

class InteractionType(enum.Enum):
CHECK = 1
HINT = 2
Expand All @@ -32,7 +38,72 @@ class QuestionType(enum.Enum):
trace = '',
)

def track(event):
def interaction_type_to_kagglesdk(event):
switch = {
InteractionType.CHECK: LearnExerciseInteractionType.CHECK,
InteractionType.HINT: LearnExerciseInteractionType.HINT,
InteractionType.SOLUTION: LearnExerciseInteractionType.SOLUTION,
}
value = event['interactionType']
assert value in switch
return switch.get(value)

def outcome_type_to_kagglesdk(interaction_type, event):
switch = {
OutcomeType.PASS: LearnExerciseOutcomeType.PASS,
OutcomeType.FAIL: LearnExerciseOutcomeType.FAIL,
OutcomeType.EXCEPTION: LearnExerciseOutcomeType.EXCEPTION,
OutcomeType.UNATTEMPTED: LearnExerciseOutcomeType.UNATTEMPTED,
}

value = event.get('outcomeType', None)
if value:
assert value in switch
return switch.get(value)
else:
assert interaction_type != LearnExerciseInteractionType.CHECK, "Check events must have an OutcomeType set: {!r}".format(event)
return LearnExerciseOutcomeType.LEARN_EXERCISE_OUTCOME_TYPE_UNSPECIFIED

def question_type_to_kagglesdk(event):
switch = {
QuestionType.EQUALITYCHECKPROBLEM: LearnExerciseQuestionType.EQUALITY_CHECK_PROBLEM,
QuestionType.CODINGPROBLEM: LearnExerciseQuestionType.CODING_PROBLEM,
QuestionType.FUNCTIONPROBLEM: LearnExerciseQuestionType.FUNCTION_PROBLEM,
QuestionType.THOUGHTEXPERIMENT: LearnExerciseQuestionType.THOUGHT_EXPERIMENT,
}

question_type = event.get('questionType', None)
if question_type:
assert question_type in switch
return switch.get(question_type)
return None

def track_using_kagglesdk(event):
request = ApiTrackExerciseInteractionRequest()
request.learn_tools_version = str(learntools.__version__)
request.value_towards_completion = event.get('valueTowardsCompletion', 0.0)
request.interaction_type = interaction_type_to_kagglesdk(event)
request.outcome_type = outcome_type_to_kagglesdk(request.interaction_type, event)
request.fork_parent_kernel_session_id = int(os.environ.get('KAGGLE_LEARN_SESSION_ID'))

question_type = question_type_to_kagglesdk(event)
if question_type:
request.question_type = question_type

client = KaggleClient()
result = client.education.education_api_client.track_exercise_interaction(request)

# Post the result back to the outer frame. When running in Kaggle
# Notebooks, the outer frame is listening for this message and may show a
# nudge.
message = dict(
jupyterEvent='custom.exercise_interaction_result',
data=result.to_json())
js = 'parent.postMessage({}, "*")'.format(json.dumps(message))
display(Javascript(js))


def track_using_iframe(event):
# TODO: could be nice to put some validation logic here.
for k, v in _EVENT_DEFAULTS.items():
event.setdefault(k, v)
Expand Down Expand Up @@ -65,3 +136,9 @@ def track(event):
display(Javascript(debug_js))
display(message)

def track(event):
if USE_KAGGLESDK:
track_using_kagglesdk(event)
else:
track_using_iframe(event)

2 changes: 1 addition & 1 deletion learntools/deep_learning_intro/dltools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import animation
plt.style.use('seaborn-whitegrid')
plt.style.use('seaborn-v0_8-whitegrid')

# NUM_EXAMPLES = 256
# BATCH_SIZE = 8
Expand Down
3 changes: 3 additions & 0 deletions learntools/ml_intermediate/ex3.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class OneHot(CodingProblem):
OH_X_train = pd.concat([num_X_train, OH_cols_train], axis=1)
OH_X_valid = pd.concat([num_X_valid, OH_cols_valid], axis=1)

# Ensure all columns have string type
OH_X_train.columns = OH_X_train.columns.astype(str)
OH_X_valid.columns = OH_X_valid.columns.astype(str)
""")

def check(self, OH_X_train, OH_X_valid):
Expand Down
6 changes: 4 additions & 2 deletions learntools/ml_intermediate/ex6.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def check(self, my_model_1):
("Please instantiate the XGBoost model with default parameters, and set the random seed "
"to 0 (e.g., `my_model_1 = XGBRegressor(random_state=0)`).")

assert my_model_1._Booster is not None, \
"Please fit the model to the training data."
try:
my_model_1.get_booster()
except:
assert 0==1, "Please fit the model to the training data."

class Model1B(CodingProblem):
_var = 'predictions_1'
Expand Down
12 changes: 6 additions & 6 deletions learntools/sql/ex3.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

# (1) ProlificCommenters
prolific_commenters_query = """
SELECT author, COUNT(id) AS NumPosts
FROM `bigquery-public-data.hacker_news.comments`
SELECT `by` AS author, COUNT(id) AS NumPosts
FROM `bigquery-public-data.hacker_news.full`
GROUP BY author
HAVING COUNT(id) > 10000
"""
Expand All @@ -19,7 +19,7 @@
# (2) NumDeletedPosts
deleted_posts_query = """
SELECT COUNT(1) AS num_deleted_posts
FROM `bigquery-public-data.hacker_news.comments`
FROM `bigquery-public-data.hacker_news.full`
WHERE deleted = True
"""
query_job = client.query(deleted_posts_query)
Expand All @@ -46,8 +46,8 @@ def check(self, results):
_solution = CS(\
"""
prolific_commenters_query = \"""
SELECT author, COUNT(1) AS NumPosts
FROM `bigquery-public-data.hacker_news.comments`
SELECT `by` AS author, COUNT(1) AS NumPosts
FROM `bigquery-public-data.hacker_news.full`
GROUP BY author
HAVING COUNT(1) > 10000
\"""
Expand All @@ -62,7 +62,7 @@ class NumDeletedPosts(EqualityCheckProblem):
# Query to determine how many posts were deleted
deleted_posts_query = \"""
SELECT COUNT(1) AS num_deleted_posts
FROM `bigquery-public-data.hacker_news.comments`
FROM `bigquery-public-data.hacker_news.full`
WHERE deleted = True
\"""

Expand Down
10 changes: 5 additions & 5 deletions learntools/sql/ex5.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ def check(self, results):
# check 2: length of dataframe
assert (len(results) == len(rides_per_year_answer)), ("The results don't look right. Try again.")
# check 3: one value in particular
year_to_check = list(rides_per_year_answer["year"])[-1]
correct_number = int(rides_per_year_answer.loc[rides_per_year_answer["year"]==year_to_check]["num_trips"].values)
submitted_number = int(results.loc[results["year"]==year_to_check]["num_trips"].values)
assert (correct_number == submitted_number), ("The results don't look right. Try again.")

year_to_check = rides_per_year_answer["year"].iloc[-1]
correct_number = rides_per_year_answer.loc[rides_per_year_answer["year"] == year_to_check, "num_trips"].iloc[0]
submitted_number = results.loc[results["year"] == year_to_check, "num_trips"].iloc[0]
assert correct_number == submitted_number, "The results don't look right. Try again."
_hint = "Start your query with `SELECT EXTRACT(YEAR FROM trip_start_timestamp) AS year, COUNT(1) AS num_trips`."
_solution = CS(
"""
Expand Down
9 changes: 6 additions & 3 deletions learntools/sql/ex6.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,17 @@ def check(self, query, results):
assert ('group by' in lower_query), ('Your query should have a **GROUP BY** clause.')
assert ('count' in lower_query), ('Your query should have a **COUNT** in the **SELECT** statement.')
assert ('%bigquery' in lower_query), ('Your **WHERE** clause is not filtering on the "bigquery" tag correctly.')

# check 2: column names
results.columns = [c.lower() for c in results.columns]
assert ('user_id' in results.columns), ('You do not have a `user_id` column in your results.')
assert ('number_of_answers' in results.columns), ('You do not have a `number_of_answers` column in your results.')

# check 3: correct user IDs
correct_ids = set([int(i) for i in bigquery_experts_answer.user_id.values if not np.isnan(i)])
submitted_ids = set([int(i) for i in results.user_id.values if not np.isnan(i)])
assert (correct_ids == submitted_ids), ('You seem to have the wrong values in the `user_id` column.')
correct_ids = bigquery_experts_answer.loc[bigquery_experts_answer.user_id.notna(), "user_id"].unique()
submitted_ids = results.loc[results.user_id.notna(), "user_id"].unique()
assert np.array_equal(np.sort(correct_ids), np.sort(submitted_ids)), 'You seem to have the wrong values in the `user_id` column.'

# check 4: check one value from other column
first_id = list(bigquery_experts_answer["user_id"])[0]
correct_num = int(bigquery_experts_answer[bigquery_experts_answer["user_id"] == first_id]["number_of_answers"])
Expand Down
10 changes: 5 additions & 5 deletions learntools/sql_advanced/ex1.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def check(self, query):
"%d rows, but you have %d rows." % (len(correct_answer), len(results)))
# check 2: calculated values
# correct result
correct_list = [i for i in list(correct_answer["time_to_answer"]) if not math.isnan(i)]
correct_number = int(sum(correct_list)/len(correct_list))
correct_list = correct_answer.loc[correct_answer["time_to_answer"].notna(), "time_to_answer"]
correct_number = correct_list.sum()/len(correct_list)
# submitted value
submitted_list = [i for i in list(results["time_to_answer"]) if not math.isnan(i)]
submitted_number = int(sum(submitted_list)/len(submitted_list))
assert (int(submitted_number)==int(correct_number)), ("The results don't look right. Please make sure that the part of the query "
submitted_list = results.loc[results["time_to_answer"].notna(), "time_to_answer"]
submitted_number = submitted_list.sum()/len(submitted_list)
assert int(submitted_number) == int(correct_number), ("The results don't look right. Please make sure that the part of the query "
"that calculates the values in the `time_to_answer` column is unmodified.")

_solution = CS(\
Expand Down
10 changes: 5 additions & 5 deletions learntools/sql_advanced/ex2.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ def check(self, query):
# check 3: check values, length of dataframe
assert (len(results)==len(break_time_answer)), ("Your answer does not have the correct number of rows.")
# check 4: specific number
id_to_check = list(break_time_answer["taxi_id"])[0]
correct_ans = [int(i) for i in list(break_time_answer.loc[break_time_answer["taxi_id"] == id_to_check]["prev_break"]) if math.isnan(i)==False]
submitted_ans = [int(i) for i in list(results.loc[results["taxi_id"] == id_to_check]["prev_break"]) if math.isnan(i)==False]
id_to_check = break_time_answer["taxi_id"].iloc[0]
correct_ans = break_time_answer.loc[break_time_answer["taxi_id"].eq(id_to_check) & break_time_answer["prev_break"].notna(), "prev_break"]
submitted_ans = results.loc[results["taxi_id"].eq(id_to_check) & results["prev_break"].notna(), "prev_break"]
if len(correct_ans) > 0:
assert (min(correct_ans)==min(submitted_ans)), ("The results don't look right. Try again.")
assert (max(correct_ans)==max(submitted_ans)), ("The results don't look right. Try again.")
assert correct_ans.min() == submitted_ans.min(), "The results don't look right. Try again."
assert correct_ans.max() == submitted_ans.max(), "The results don't look right. Try again."

_solution = CS( \
"""
Expand Down
2 changes: 1 addition & 1 deletion learntools/time_series/ex3.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Q2(CodingProblem): # Create seasonal features
def check(self, dp, X):
from statsmodels.tsa.deterministic import (CalendarFourier,
DeterministicProcess)
y = load_average_sales()['2017']
y = load_average_sales().loc['2017']
fourier = CalendarFourier(freq='M', order=4)
dp = DeterministicProcess(
index=y.index,
Expand Down
2 changes: 1 addition & 1 deletion learntools/time_series/ex4.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from learntools.core import *
from learntools.time_series.checking_utils import load_store_sales, load_family_sales
from learntools.time_series.checking_utils import load_family_sales
from learntools.time_series.utils import make_lags, make_leads


Expand Down
2 changes: 1 addition & 1 deletion learntools/time_series/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

warnings.simplefilter("ignore")

plt.style.use("seaborn-whitegrid")
plt.style.use("seaborn-v0_8-whitegrid")
plt.rc(
"figure",
autolayout=True,
Expand Down
2 changes: 1 addition & 1 deletion learntools/time_series/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def seasonal_plot(X, y, period, freq, ax=None):

def plot_periodogram(ts, detrend='linear', ax=None):
from scipy.signal import periodogram
fs = pd.Timedelta("1Y") / pd.Timedelta("1D")
fs = pd.Timedelta("365D") / pd.Timedelta("1D")
freqencies, spectrum = periodogram(
ts,
fs=fs,
Expand Down
4 changes: 4 additions & 0 deletions notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ If you create further config files (e.g. `testing.yaml`), they will generate the
`prepare_push.py` translates notebooks in `raw/` to publishable notebooks in `rendered/`.
The logic for this step mostly lives in `lesson_preprocessor.py`. Most of its work is in expanding macros which look like `#$HIDE_OUTPUT$`, or `#$EXERCISE_URL(2)$`. See MACROS.txt for a listing of available macros.

`prepare_push.py` requires a few libraries that may need to be installed before continuing.

The Kaggle Kernels API requires a `kernel-metadata.json` file for any kernel being pushed to the site. `prepare_push.py` also generates these in the `kernels_api_metadata` subdirectory.

## Step 2: Pushing

The push process uses the Kaggle Kernels API, so it requires a valid API key with write permissions to the learn notebooks to update. Additionally, if pushing an exercise, the pushing account should be included in the `ops-kernels-commits-allow-errors` flag, which enables the notebook to be published despite known errors where the Learn users will fill in the missing code.

Use ./pushall.sh as
./pushall deep_learning/prod

Expand Down
2 changes: 1 addition & 1 deletion notebooks/computer_vision/raw/ex1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"Now that the base is defined to do the feature extraction, create a head of `Dense` layers to perform the classification, following this diagram:\n",
"\n",
"<figure>\n",
"<img src=\"https://i.imgur.com/i5VU7Ry.png\" alt=\"Diagram of the dense head.\">\n",
"<img src=\"https://storage.googleapis.com/kaggle-media/learn/images/i5VU7Ry.png\" alt=\"Diagram of the dense head.\">\n",
"</figure>\n"
]
},
Expand Down
2 changes: 1 addition & 1 deletion notebooks/computer_vision/raw/ex4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"What happens if you add another convolutional layer with $3 \\times 3$ kernels? Consider this next illustration:\n",
"\n",
"<figure>\n",
"<img src=\"https://i.imgur.com/HmwQm2S.png\" alt=\"Illustration of the receptive field of two stacked convolutions.\" width=250>\n",
"<img src=\"https://storage.googleapis.com/kaggle-media/learn/images/HmwQm2S.png\" alt=\"Illustration of the receptive field of two stacked convolutions.\" width=250>\n",
"</figure>\n",
"\n",
"Now trace back the connections from the neuron at top and you can see that it's connected to a $5 \\times 5$ patch of pixels in the input (the bottom layer): each neuron in the $3 \\times 3$ patch in the middle layer is connected to a $3 \\times 3$ input patch, but they overlap in a $5 \\times 5$ patch. So that neuron at top has a $5 \\times 5$ receptive field."
Expand Down
2 changes: 1 addition & 1 deletion notebooks/computer_vision/raw/ex5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"\n",
"<figure>\n",
"<!-- <img src=\"./images/2-convmodel-2.png\" width=\"250\" alt=\"Diagram of a convolutional model.\"> -->\n",
"<img src=\"https://i.imgur.com/Vko6nCK.png\" width=\"250\" alt=\"Diagram of a convolutional model.\">\n",
"<img src=\"https://storage.googleapis.com/kaggle-media/learn/images/Vko6nCK.png\" width=\"250\" alt=\"Diagram of a convolutional model.\">\n",
"</figure>\n",
"\n",
"# 1) Define Model #\n",
Expand Down
Loading