Unnamed: 0 int64 0 16k | text_prompt stringlengths 110 62.1k | code_prompt stringlengths 37 152k |
|---|---|---|
10,700 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Welcome to Computer Vision!
Have you ever wanted to teach a computer to see? In this course, that's exactly what you'll do!
In this course, you'll
Step1: Let's take a look at a few examples... | Python Code:
#$HIDE_INPUT$
# Imports
import os, warnings
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import tensorflow as tf
from tensorflow.keras.preprocessing import image_dataset_from_directory
# Reproducability
def set_seed(seed=31415):
np.random.seed(seed)
tf.random.s... |
10,701 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Overview
This is a generalized notebook for computing grade statistics from the Ted Grade Center.
Step1: Load data from exported CSV from Ted Full Grade Center. Some sanitization is perform... | Python Code:
#The usual imports
import math
import glob
import os
from collections import OrderedDict
from pandas import read_csv
import numpy as np
from pymatgen.util.plotting_utils import get_publication_quality_plot
from monty.string import remove_non_ascii
import prettyplotlib as ppl
from prettyplotlib import brewe... |
10,702 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Robust PCA Example
Robust PCA is an awesome relatively new method for factoring a matrix into a low rank component and a sparse component. This enables really neat applications for outlier ... | Python Code:
%matplotlib inline
Explanation: Robust PCA Example
Robust PCA is an awesome relatively new method for factoring a matrix into a low rank component and a sparse component. This enables really neat applications for outlier detection, or models that are robust to outliers.
End of explanation
import matplotli... |
10,703 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Visualización e interacción
La visualización e interacción es un requerimiento actual para las nuevas metodologías de enseñanza, donde se busca un aprendizaje mucho más visual y que permita,... | Python Code:
from math import sin, cos, tan, sqrt, log, exp, pi
Explanation: Visualización e interacción
La visualización e interacción es un requerimiento actual para las nuevas metodologías de enseñanza, donde se busca un aprendizaje mucho más visual y que permita, a través de la experimentación, el entendimiento de ... |
10,704 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Testing a Change in the Auto Owernship Model
Create two auto ownership examples to illustrate running two scenarios and analyzing results. This notebook assumes users are familiar with the ... | Python Code:
!activitysim create -e example_mtc -d example_base_auto_own
!activitysim create -e example_mtc -d example_base_auto_own_alternative
Explanation: Testing a Change in the Auto Owernship Model
Create two auto ownership examples to illustrate running two scenarios and analyzing results. This notebook assumes ... |
10,705 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Kepler Hack
Step10: Here's the completeness model to apply to Q1—Q17 catalog
Step11: And a function for estimating the occurrence rate (assumed constant) in a bin in $T_\mathrm{eff}... | Python Code:
import os
import requests
import numpy as np
import pandas as pd
from io import BytesIO # Python 3 only!
import matplotlib.pyplot as pl
def get_catalog(name, basepath="data"):
Download a catalog from the Exoplanet Archive by name and save it as a
Pandas HDF5 file.
:param name: the tab... |
10,706 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Deep Deterministic Policy Gradient (DDPG)
Author
Step1: We use OpenAIGym to create the environment.
We will use the upper_bound parameter to scale our actions later.
Step2: To implement be... | Python Code:
import gym
import tensorflow as tf
from tensorflow.keras import layers
import numpy as np
import matplotlib.pyplot as plt
Explanation: Deep Deterministic Policy Gradient (DDPG)
Author: amifunny<br>
Date created: 2020/06/04<br>
Last modified: 2020/09/21<br>
Description: Implementing DDPG algorithm on the In... |
10,707 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Scapy in 15 minutes (or longer)
Guillaume Valadon & Pierre Lalet
Scapy is a powerful Python-based interactive packet manipulation program and library. It can be used to forge or decode packe... | Python Code:
send(IP(dst="1.2.3.4")/TCP(dport=502, options=[("MSS", 0)]))
Explanation: Scapy in 15 minutes (or longer)
Guillaume Valadon & Pierre Lalet
Scapy is a powerful Python-based interactive packet manipulation program and library. It can be used to forge or decode packets for a wide number of protocols, send the... |
10,708 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<header class="w3-container w3-teal">
<img src="images/utfsm.png" alt="" height="100px" align="left"/>
<img src="images/mat.png" alt="" height="100px" align="right"/>
</header>
<br/><br/><br... | Python Code:
def hamming(s1, s2):
# Caso no comparable
if len(s1)!=len(s2):
print("No comparable")
return None
h = 0
# Caso comparable
for ch1, ch2 in zip(s1,s2):
if ch1!=ch2:
h+= 1
# FIX ME
return h
print hamming("cara", "c")
print hamming("cara", "casa"... |
10,709 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Enriching Shooting Data
Goal
Step1: The query in the below box no longer works thanks to the NBA restricting access to the data.
Step2: Wrapping data merge into a function
Step3: Drawing ... | Python Code:
# Getting Basic Data
import goldsberry
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
pd.set_option("display.max_columns", 50)
pd.options.mode.chained_assignment = None
print goldsberry.__version__
print pd.__version__
# Getting Players List
players_2015 = gol... |
10,710 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Simple sphere and text
Step1: Clickable Surface
Step2: Design our own texture
Step3: Lines
Step4: Camera
Step6: Parametric Functions
To use the ParametricGeometry class, you need to spe... | Python Code:
ball = Mesh(geometry=SphereGeometry(radius=1), material=LambertMaterial(color='red'), position=[2,1,0])
scene = Scene(children=[ball, AmbientLight(color=0x777777), make_text('Hello World!', height=.6)])
c = PerspectiveCamera(position=[0,5,5], up=[0,0,1], children=[DirectionalLight(color='white',
... |
10,711 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Data Bootcamp "Group Project"
Analysis of historical stock return and volatility by industries using Fama-French Data
Sung Kim / Arthur Hong / Kevin Park
Contents
Step1: 1 | Background
Desi... | Python Code:
# import packages
import pandas as pd # data management
import matplotlib.pyplot as plt # graphics
import datetime as dt # check today's date
import sys # check Python version
import numpy as np
# IPython command, puts plots in notebook... |
10,712 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Statistical inference
Here we will briefly cover multiple concepts of inferential statistics in an
introductory manner, and demonstrate how to use some MNE statistical functions.
Step1: Hyp... | Python Code:
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD-3-Clause
from functools import partial
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa, analysis:ignore
import mne
from mne.stats import (ttest_1samp_no_p, bonferroni... |
10,713 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Cartopy in a nutshell
Cartopy is a Python package that provides easy creation of maps, using matplotlib, for the analysis and visualisation of geospatial data.
In order to create a map with ... | Python Code:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
Explanation: Cartopy in a nutshell
Cartopy is a Python package that provides easy creation of maps, using matplotlib, for the analysis and visualisation of geospatial data.
In order to create a map with cartopy and matplotlib, we typically need to ... |
10,714 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
This notebook explores how collaborative relationships form between mailing list participants over time.
The hypothesis, loosely put, is that early exchanges are indicators of growing relati... | Python Code:
%matplotlib inline
Explanation: This notebook explores how collaborative relationships form between mailing list participants over time.
The hypothesis, loosely put, is that early exchanges are indicators of growing relationships or trust that should be reflected in information flow at later times.
End of ... |
10,715 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Systemic Velocity
Setup
Let's first make sure we have the latest version of PHOEBE 2.0 installed. (You can comment out this line if you don't use pip for your installation or don't want to u... | Python Code:
!pip install -I "phoebe>=2.0,<2.1"
%matplotlib inline
Explanation: Systemic Velocity
Setup
Let's first make sure we have the latest version of PHOEBE 2.0 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
i... |
10,716 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
WMI Module Load
Metadata
| | |
|
Step1: Download & Process Mordor Dataset
Step2: Analytic I
Look for processes (non wmiprvse.exe or WmiApSrv.exe) loading wmi modules
|... | Python Code:
from openhunt.mordorutils import *
spark = get_spark()
Explanation: WMI Module Load
Metadata
| | |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2019/08/11 |
| modification date | 2020/09/20 |
| playbook related | [] |
Hypoth... |
10,717 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
PhenoCam ROI Summary Files
Here's a python notebook demonstrating how to read in and plot an ROI (Region of Interest) summary using python. In this case I'm using the 1-day summary file fro... | Python Code:
%matplotlib inline
import os, sys
import numpy as np
import matplotlib
import pandas as pd
import requests
import StringIO
# set matplotlib style
matplotlib.style.use('ggplot')
sitename = 'alligatorriver'
roiname = 'DB_0001'
infile = "{}_{}_1day.csv".format(sitename, roiname)
print infile
%%bash
head -30 ... |
10,718 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step2: 3T_데이터 분석을 위한 SQL 실습 (2) - SUB QUERY, HAVING
유저별 매출을 출력하세요. customer, payment
Step3: JOIN은 조금 어렵지만 속도가 WHERE보다 빠르다.
Step8: 서브쿼리랑 HAVING 다시 천천히 해보자
렌탈 횟수가 30회 이상인 유저
Step9: pandas
S... | Python Code:
import pymysql
db = pymysql.connect(
"db.fastcamp.us",
"root",
"dkstncks",
"sakila",
charset='utf8',
)
customer_df = pd.read_sql("SELECT * FROM customer;", db)
payment_df = pd.read_sql("SELECT * FROM payment;", db)
customer_df.head(1)
payment_df.head(1)
SQL_QUERY =
SELECT c.first_n... |
10,719 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Three Little Circles
The "Hello World" (or Maxwell's Equations) of d3, Three Little Circles introduces all of the main concepts in d3, which gives you a pretty good grounding in data visuali... | Python Code:
from livecoder.widgets import Livecoder
from IPython.utils import traitlets as T
Explanation: Three Little Circles
The "Hello World" (or Maxwell's Equations) of d3, Three Little Circles introduces all of the main concepts in d3, which gives you a pretty good grounding in data visualization, JavaScript, and... |
10,720 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Vertex AI
Step1: Install the latest GA version of google-cloud-storage library as well.
Step2: Restart the kernel
Once you've installed the additional packages, you need to restart the not... | Python Code:
import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
Explanation: Vertex AI: Vertex AI Migration: Custom XGBoost model with pre-built training container
<t... |
10,721 | Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
How can I get get the position (indices) of the smallest value in a multi-dimensional NumPy array `a`? | Problem:
import numpy as np
a = np.array([[10,50,30],[60,20,40]])
result = a.argmin() |
10,722 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Functions tutorial
In astromodels functions can be used as spectral shapes for sources, or to describe time-dependence, phase-dependence, or links among parameters.
To get the list of availa... | Python Code:
from astromodels import *
list_functions()
Explanation: Functions tutorial
In astromodels functions can be used as spectral shapes for sources, or to describe time-dependence, phase-dependence, or links among parameters.
To get the list of available functions just do:
End of explanation
powerlaw.info()
Exp... |
10,723 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Exploring Mobile Gaming Using Feature Store
Learning objectives
In this notebook, you learn how to
Step1: Restart the kernel
After you install the additional packages, you need to restart t... | Python Code:
import os
# The Google Cloud Notebook product has specific requirements
IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version")
# Google Cloud Notebook requires dependencies to be installed with '--user'
USER_FLAG = ""
if IS_GOOGLE_CLOUD_NOTEBOOK:
USER_FLAG = "--user"
# Inst... |
10,724 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Block logs
We'd like to make blocky, upscaled versions of logs.
Let's load a well from an LAS File using welly
Step1: We can block this log based on some cutoffs
Step2: But now we're not r... | Python Code:
from welly import Well
w = Well.from_las('P-129_out.LAS')
w
gr = w.data['GR']
gr
Explanation: Block logs
We'd like to make blocky, upscaled versions of logs.
Let's load a well from an LAS File using welly:
End of explanation
gr_blocky = gr.block(cutoffs=[40, 100])
gr_blocky.plot()
Explanation: We can block... |
10,725 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Numpy Exercise 2
Imports
Step2: Factorial
Write a function that computes the factorial of small numbers using np.arange and np.cumprod.
Step4: Write a function that computes the factorial ... | Python Code:
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
Explanation: Numpy Exercise 2
Imports
End of explanation
def np_fact(n):
Compute n! = n*(n-1)*...*1 using Numpy.
if n == 0:
return 1
else:
a = np.arange(1,n+1,1)
b = a.cumprod(0)
... |
10,726 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Compare impact of frequency dependent $D_{min}$
Step1: Frequency dependence of $D_{min}$ predicted by Darendeli (2001)
Calculation
Step2: Plots
Step3: Site Response Calculation
Input
Step... | Python Code:
import itertools
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pysra
%matplotlib inline
plt.rcParams["figure.dpi"] = 150
Explanation: Compare impact of frequency dependent $D_{min}$
End of explanation
plast_indices = [0, 20, 50, 100]
stresses_mean = 101.3 * np.array([0.5, 1,... |
10,727 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Speci... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-2', 'ocnbgchem')
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-2
Topic: Ocnbgchem
Sub-Topics: Trac... |
10,728 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Frequency and time-frequency sensors analysis
The objective is to show you how to explore the spectral content
of your data (frequency and time-frequency). Here we'll work on Epochs.
We will... | Python Code:
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Stefan Appelhoff <stefan.appelhoff@mailbox.org>
# Richard Höchenberger <richard.hoechenberger@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.ti... |
10,729 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Bokeh scatter plot introduction
Step1: <a id='index'></a>
Index
Back to top
1 Introduction
2 ScatterPlot components
2.1 The scatter plot marker
2.2 Internal structure
2.3 Data structures
2.... | Python Code:
%%HTML
<style>
.container { width:100% !important; }
.input{ width:60% !important;
align: center;
}
.text_cell{ width:70% !important;
font-size: 16px;}
.title {align:center !important;}
</style>
Explanation: Bokeh scatter plot introduction
End of explanation
from IPython.display im... |
10,730 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Parte 1
Step1: 2. Realizar y verificar la descomposición svd.
Step2: 3. Usar la descomposición para dar una aproximación de grado <code>k</code> de la imagen.</li>
4. Para alguna imagen de... | Python Code:
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
#url = sys.argv[1]
url = 'Mario.png'
img = Image.open(url)
imggray = img.convert('LA')
Explanation: Parte 1: Teoría de Algebra Lineal y Optimización
1. ¿Por qué una matriz equivale a una transformación lineal entre espacios vectorial... |
10,731 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step2: Experiment and anlyse some features creation
Step3: Read and prepare the data
Step4: Cleaning dataset
Step5: Create dataset for learning
Step6: Create Target learning & analyse me... | Python Code:
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.dates as mdates
from matplotlib import pyplot as plt
import seaborn as sns
# Set random
np.random.seed(42)
import sys
sys.path.append('../')
from prediction import (datareader, complete_data, cleanup, bikes... |
10,732 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ToppGene & Pathway Visualization
Authors
Step1: Read in differential expression results as a Pandas data frame to get differentially expressed gene list
Step2: Translate Ensembl IDs to Gen... | Python Code:
#Import Python modules
import os
import pandas
import qgrid
import mygene
#Change directory
os.chdir("/data/test")
Explanation: ToppGene & Pathway Visualization
Authors: N. Mouchamel, L. Huang, T. Nguyen, K. Fisch
Email: Kfisch@ucsd.edu
Date: June 2016
Goal: Create Jupyter notebook that runs an enrichment ... |
10,733 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Image Classification
In this project, you'll classify images from the CIFAR-10 dataset. The dataset consists of airplanes, dogs, cats, and other objects. You'll preprocess the images... | Python Code:
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifa... |
10,734 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
This notebook contains the code from the original and adds a section to produce animations (which I believe was originally in there, but may have gone missing at some point).
DeepDreaming wi... | Python Code:
# boilerplate code
from __future__ import print_function
import os
from io import BytesIO
import numpy as np
from functools import partial
import PIL.Image
from IPython.display import clear_output, Image, display, HTML
import tensorflow as tf
Explanation: This notebook contains the code from the original a... |
10,735 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
A Basic Model
In this example application it is shown how a simple time series model can be developed to simulate groundwater levels. The recharge (calculated as precipitation minus evaporat... | Python Code:
import matplotlib.pyplot as plt
import pandas as pd
import pastas as ps
ps.show_versions()
Explanation: A Basic Model
In this example application it is shown how a simple time series model can be developed to simulate groundwater levels. The recharge (calculated as precipitation minus evaporation) is used ... |
10,736 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
This is a notebook to aid in the development of the market simulator. One initial version was created as part of the Machine Learning for Trading course. It has to be adapted for use in the ... | Python Code:
# Basic imports
import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import datetime as dt
import scipy.optimize as spo
import sys
from time import time
from sklearn.metrics import r2_score, median_absolute_error
%matplotlib inline
%pylab inline
pylab.rcParams['figure.figsize'] ... |
10,737 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Forecasting I
Step1: Intro to Pyro's forecasting framework
Pyro's forecasting framework consists of
Step2: Let's start with a simple log-linear regression model, with no trend or seasonali... | Python Code:
import torch
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from pyro.contrib.examples.bart import load_bart_od
from pyro.contrib.forecast import ForecastingModel, Forecaster, backtest, eval_crps
from pyro.infer.reparam import LocScaleReparam, StableReparam
from pyro.ops.tenso... |
10,738 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Title
Step1: Create A Temporary File
Step2: Write To The Temp File
Step3: View The Tmp File's Name
Step4: Read The File
Step5: Close (And Thus Delete) The File | Python Code:
from tempfile import NamedTemporaryFile
Explanation: Title: Create A Temporary File
Slug: create_a_temporary_file
Summary: Create A Temporary File Using Python.
Date: 2017-02-02 12:00
Category: Python
Tags: Basics
Authors: Chris Albon
Preliminaries
End of explanation
f = NamedTemporaryFile('w+t')
Explana... |
10,739 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Outline
Glossary
2. Mathematical Groundwork
Previous
Step1: Import section specific modules
Step3: 2.8. The Discrete Fourier Transform (DFT) and the Fast Fourier Transform (FFT)<a id='math... | Python Code:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import HTML
HTML('../style/course.css') #apply general CSS
Explanation: Outline
Glossary
2. Mathematical Groundwork
Previous: 2.7 Fourier Theorems
Next: 2.9 Sampling Theory
Import standard modules:
End of explanatio... |
10,740 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Numpy Exercise 3
Imports
Step2: Geometric Brownian motion
Here is a function that produces standard Brownian motion using NumPy. This is also known as a Wiener Process.
Step3: Call the bro... | Python Code:
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
Explanation: Numpy Exercise 3
Imports
End of explanation
def brownian(maxt, n):
Return one realization of a Brownian (Wiener) process with n steps a... |
10,741 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Possible/Extant/All pattern
Another form of joining made possible by the util module is very powerful. Here is an example reusing the chan_div_2 and chan_div_3 from the previous chapter
Ste... | Python Code:
from flowz.util import merge_keyed_channels
chan_div_2 = IterChannel(KeyedArtifact(i, i) for i in range(1, 13) if i % 2 == 0)
chan_div_3 = IterChannel(KeyedArtifact(i, i*10) for i in range(1, 13) if i % 3 == 0)
merged = merge_keyed_channels(chan_div_2, chan_div_3)
print_chans(merged)
Explanation: Possible/... |
10,742 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Built-in Time Functions
Field profiles are defined as functions of time. A base rabi_freq is multiplied by a time function rabi_freq_t_func and related arguments rabi_freq_t_args. For exampl... | Python Code:
from maxwellbloch import t_funcs
tlist = np.linspace(0., 1., 201)
Explanation: Built-in Time Functions
Field profiles are defined as functions of time. A base rabi_freq is multiplied by a time function rabi_freq_t_func and related arguments rabi_freq_t_args. For example, a Gaussian pulse with a peak of $\... |
10,743 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Composites simulation
Step1: We need to import here the data, modify them if needed and proceed
Step2: Now let's study the evolution of the concentration | Python Code:
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from simmit import smartplus as sim
from simmit import identify as iden
import os
import itertools
dir = os.path.dirname(os.path.realpath('__file__'))
Explanation: Composites simulation : perform parametric analyses
... |
10,744 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Plot point-spread functions (PSFs) and cross-talk functions (CTFs)
Visualise PSF and CTF at one vertex for sLORETA.
Step1: Visualize
PSF
Step2: CTF | Python Code:
# Authors: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
from mne.minimum_norm import (make_inverse_resolution_matrix, get_cross_talk,
get_point_spread)... |
10,745 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Global-scale MODIS NDVI time series analysis (with interpolation)
A material for the presentation in FOSS4G-Hokkaido on 1st July 2017.
Copyright © 2017 Naru. Tsutsumida (naru@kais.kyoto-u.ac... | Python Code:
from IPython.display import Image, display, HTML
%matplotlib inline
from pylab import *
import datetime
import math
import time
import ee
ee.Initialize()
Explanation: Global-scale MODIS NDVI time series analysis (with interpolation)
A material for the presentation in FOSS4G-Hokkaido on 1st July 2017.
Copyr... |
10,746 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Connect to the database
Log in to Firebase with our credentials. The fake-looking credentials are working credentials. Non-authenticated users cannot read or write data. This function must b... | Python Code:
firebase = pyrebase.initialize_app(config)
auth = firebase.auth()
uid = ""
password = ""
user = auth.sign_in_with_email_and_password(uid, password)
db = firebase.database() # reference to the database service
def firebaseRefresh():
global user
user = auth.refresh(user['refreshToken'])
Exp... |
10,747 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Sample from the Gaussian Process by use of the Cholesky decomposition of the Kernel matrix
Step1: Sample from the posterior given points at (0.1, 0.0), (0.5, 1.0) | Python Code:
n_sample = 50000
u = np.random.randn(N, n_sample)
X = L.dot(u)
_ = plt.plot(X[:, np.random.permutation(n_sample)[:500]], c='k', alpha=0.05)
_ = plt.plot(X.mean(axis=1), c='k', linewidth=2)
_ = plt.plot(2*X.std(axis=1), c='r', linewidth=2)
_ = plt.plot(-2*X.std(axis=1), c='r', linewidth=2)
Explanation: Samp... |
10,748 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
.. _tut_raw_objects
The
Step1: Continuous data is stored in objects of type
Step2: Information about the channels contained in the
Step3: You can also pass an index directly to the
St... | Python Code:
from __future__ import print_function
import mne
import os.path as op
from matplotlib import pyplot as plt
Explanation: .. _tut_raw_objects
The :class:Raw <mne.io.RawFIF> data structure: continuous data
End of explanation
# Load an example dataset, the preload flag loads the data into memory now
data... |
10,749 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Executed
Step1: Load software and filenames definitions
Step2: Data folder
Step3: List of data files
Step4: Data load
Initial loading of the data
Step5: Laser alternation selection
At t... | Python Code:
ph_sel_name = "all-ph"
data_id = "12d"
# ph_sel_name = "all-ph"
# data_id = "7d"
Explanation: Executed: Mon Mar 27 11:34:19 2017
Duration: 8 seconds.
usALEX-5samples - Template
This notebook is executed through 8-spots paper analysis.
For a direct execution, uncomment the cell below.
End of explanation
fro... |
10,750 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Les bases de la dynamique des populations
À voir
Step1: Ainsi
lorsque $\mu>\lambda$ la population croît exponentiellement
lorsque $\lambda<\mu$ la population tend exponentiellement vers 0.... | Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
t0, t1 = 0, 10
temps = np.linspace(t0,t1,200, endpoint=True)
population = lambda t: x0*np.exp((rb-rd)*t)
legende = []
for x0, rb, rd in zip([1, 1, 1], [1, 1, 0.9], [0.9, 1, 1]):
plt.plot(temps, population(temps))
legende = legend... |
10,751 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
.. _tut_creating_data_structures
Step1: Creating
Step2: You can also supply more extensive metadata
Step3: .. note
Step4: Creating
Step5: It is necessary to supply an "events" array i... | Python Code:
from __future__ import print_function
import mne
import numpy as np
Explanation: .. _tut_creating_data_structures:
Creating MNE-Python's data structures from scratch
End of explanation
# Create some dummy metadata
n_channels = 32
sampling_rate = 200
info = mne.create_info(32, sampling_rate)
print(info)
Exp... |
10,752 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Aerosol
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specify... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-2', 'aerosol')
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CSIR-CSIRO
Source ID: SANDBOX-2
Topic: Aerosol
Sub-Topics: Transpor... |
10,753 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
This notebook will demonstrate how to do basic SuperDARN data plotting.
Step1: Remote File RTI Plots
Step2: Local File RTI Plot
You can also plot data stored in a local file. Just change ... | Python Code:
%pylab inline
import datetime
import os
import matplotlib.pyplot as plt
from davitpy import pydarn
sTime = datetime.datetime(2008,2,22)
eTime = datetime.datetime(2008,2,23)
radar = 'bks'
beam = 7
Explanation: This notebook will demonstrate how to do basic SuperDARN data plotting.
End of explanation
#The f... |
10,754 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
A Simple Autoencoder
We'll start off by building a simple autoencoder to compress the MNIST dataset. With autoencoders, we pass input data through an encoder that makes a compressed represen... | Python Code:
%matplotlib inline
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', validation_size=0)
Explanation: A Simple Autoencoder
We'll start off by building a simple autoencoder to c... |
10,755 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Bias Evaluation for TF Javascript Model
Based on the FAT* Tutorial Measuring Unintended Bias in Text Classification Models with Real Data.
Copyright 2019 Google LLC.
SPDX-License-Identifier
... | Python Code:
!pip3 install --quiet "tensorflow>=1.11"
!pip3 install --quiet sentencepiece
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow ... |
10,756 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Merge Sort
Step1: The function mergeSort is called with 4 arguments.
- The first parameter $\texttt{L}$ is the list that is to be sorted.
However, the task of $\texttt{mergeSort}$ is ... | Python Code:
def sort(L):
A = L[:]
mergeSort(L, 0, len(L), A)
Explanation: Merge Sort: A Recursive, Array Based Implementation
The function $\texttt{sort}(L)$ sorts the list $L$ in place using <em style="color:blue">merge sort</em>.
It takes advantage of the fact that, in Python, lists are stored internally as ... |
10,757 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Interface to statsmodels
Step1: ARMA errors
We assume that the observed data $y(t)$ follows
$$y(t)= f(t; \theta) + \epsilon(t),$$
where $f(t; \theta)$ is the logistic model solution.
Under ... | Python Code:
import pints
import pints.toy as toy
import pints.plot
import numpy as np
import matplotlib.pyplot as plt
Explanation: Interface to statsmodels: ARIMA time series models
This notebook provides a short exposition of how it is possible to interface with the cornucopia of time series models provided by the st... |
10,758 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Alignment
The align function projects 2 or more datasets with different coordinate systems into a common space. By default it uses the hyperalignment algorithm (Haxby et al, 2011), but also... | Python Code:
import hypertools as hyp
import numpy as np
%matplotlib inline
Explanation: Alignment
The align function projects 2 or more datasets with different coordinate systems into a common space. By default it uses the hyperalignment algorithm (Haxby et al, 2011), but also provides the option to use the Shared Re... |
10,759 |
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
Sklearn SVR - Training a SVM Regression Model with Python
| Python Code::
from sklearn.svm import SVR
from sklearn.metrics import mean_squared_error, mean_absolute_error
# initliase & fit model
model = SVR(C=1.5, kernel='linear')
model.fit(X_train, y_train)
# make prediction for test data
y_pred = model.predict(X_test)
# evaluate performance
print('RMSE:',mean_squared_error(y_t... |
10,760 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Sightline gridding
We demonstrate the gridding of selected sightlines with cygrid. This can be particularly useful if you have some high-resolution data such as QSO absorption spectra and wa... | Python Code:
%load_ext autoreload
%autoreload 2
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
Explanation: Sightline gridding
We demonstrate the gridding of selected sightlines with cygrid. This can be particularly useful if you have some high-resolution data such as QSO absorption spectra and want ... |
10,761 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Paramz Tutorial
A simple introduction into Paramz based gradient based optimization of parameterized models.
Paramz is a python based parameterized modelling framework, that handles paramete... | Python Code:
import paramz, numpy as np
from scipy.optimize import rosen_der, rosen
Explanation: Paramz Tutorial
A simple introduction into Paramz based gradient based optimization of parameterized models.
Paramz is a python based parameterized modelling framework, that handles parameterization, printing, randomizing a... |
10,762 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Community Detection Lab (week 2
Step1: Task 5.1. Apply Girvan-Newman method
Apply Girvan-Newman algorithm
Step2: Apply available Girvan-Newman algorithm and compare results | Python Code:
# Import python-igraph library
import igraph
from IPython.display import Image
# Note: email graph is too large for the fast execution of the Girvan-Newman method, so we use karate graph,
# which is available on github and was taken from http://www.cise.ufl.edu/research/sparse/matrices/Newman/karate.html
... |
10,763 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Single amino-acid / physico-chemical properties
Step1: Linear modeling, subsampling the negative set ~20 times
Step2: Charge can predict TAD with AUC=0.88 <br> aminoacid composition with A... | Python Code:
# create one numpy_map array for positives and 12 for negatives
idx = positives_train
p = get_aa_frequencies(positives[idx,0])
p_train, p_filename = store_data_numpy(np.hstack(p).T, float)
# set the positive validation array
idx = positives_validation
p_valid = get_aa_frequencies(positives[idx,0])
p_valid ... |
10,764 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
CSE 6040, Fall 2015 [28]
Step1: Read in data
Step2: Fast implementation of the distance matrix computation
The idea is that $$||(x - c)||^2 = ||x||^2 - 2\langle x, c \rangle + ||c||^2 $$
... | Python Code:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
Explanation: CSE 6040, Fall 2015 [28]: K-means Clustering, Part 2
Last time, we implemented the basic version of K-means. In this lecture we will explore some advanced techniques
to improve the p... |
10,765 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Functions and Methods Homework
Complete the following questions
Step1: Write a function that checks whether a number is in a given range (Inclusive of high and low)
Step2: If you only want... | Python Code:
import math
def vol(rad):
return 4/3*math.pi*rad**4
vol(5)
l_vol = lambda rad: 4/3*math.pi*rad**4
l_vol(5)
Explanation: Functions and Methods Homework
Complete the following questions:
Write a function that computes the volume of a sphere given its radius.
End of explanation
def ran_check(num,low,high)... |
10,766 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
View in Colaboratory
Step1: Variables
TensorFlow variables are useful to store the state in your program. They are integrated with other parts of the API (taking gradients, checkpointing, g... | Python Code:
import tensorflow as tf
tf.enable_eager_execution()
tfe = tf.contrib.eager
Explanation: View in Colaboratory
End of explanation
# Creating variables
v = tfe.Variable(1.0)
v
v.assign_add(1.0)
v
Explanation: Variables
TensorFlow variables are useful to store the state in your program. They are integrated wit... |
10,767 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Churn Predictive Analytics using Amazon SageMaker and Snowflake
Background
The purpose of this lab is to demonstrate the basics of building an advanced analytics solution using Amazon SageMa... | Python Code:
import boto3
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import io
import os
import sys
import time
import json
from IPython.display import display
from time import strftime, gmtime
import sagemaker
from sagemaker.predictor import csv_serializer
from sagemaker import get_executio... |
10,768 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Example 2
Step1: Create some dictionarys with parameters for cell, synapse and extracellular electrode
Step2: Then, create the cell, synapse and electrode objects using the
LFPy.Cell, LFPy... | Python Code:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import LFPy
Explanation: Example 2: Extracellular response of synaptic input
This is an example of LFPy running in a Jupyter notebook. To run through this example code and produce output, press <shift-Enter> i... |
10,769 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Introduction to FermiLib
Note that all the examples below must be run sequentially within a section.
Initializing the FermionOperator data structure
Fermionic systems are often treated in se... | Python Code:
from fermilib.ops import FermionOperator
my_term = FermionOperator(((3, 1), (1, 0)))
print(my_term)
my_term = FermionOperator('3^ 1')
print(my_term)
Explanation: Introduction to FermiLib
Note that all the examples below must be run sequentially within a section.
Initializing the FermionOperator data struct... |
10,770 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<h1> Hyper-parameter tuning </h1>
Learning Objectives
1. Understand various approaches to hyperparameter tuning
2. Automate hyperparameter tuning using AI Platform HyperTune
Introduction
In ... | Python Code:
PROJECT = "cloud-training-demos" # Replace with your PROJECT
BUCKET = "cloud-training-bucket" # Replace with your BUCKET
REGION = "us-central1" # Choose an available region for AI Platform
TFVERSION = "1.14" # TF version for AI Platform
import os
os.environ["PROJECT"] = PROJE... |
10,771 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about emb... | Python Code:
import time
import numpy as np
import tensorflow as tf
import utils
Explanation: Skip-gram word2vec
In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural lang... |
10,772 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Getting started with Python
Step1: Create some variables in Python
Step2: Advanced python types
Step3: Advanced printing
Step4: Conditional statements in python
Step5: Conditional loops... | Python Code:
print ('Hello World!')
Explanation: Getting started with Python
End of explanation
i = 4 # int
type(i)
f = 4.1 # float
type(f)
b = True # boolean variable
s = "This is a string!"
print s
Explanation: Create some variables in Python
End of explanation
l = [3,1,2] # list
print l
d = {'foo':1, 'bar':2.3, ... |
10,773 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Vertex SDK
Step1: Install the latest GA version of google-cloud-storage library as well.
Step2: Restart the kernel
Once you've installed the additional packages, you need to restart the no... | Python Code:
import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
Explanation: Vertex SDK: Custom training tabular regression model for online prediction with explainab... |
10,774 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Images are numpy arrays
Images are represented in scikit-image using standard numpy arrays. This allows maximum inter-operability with other libraries in the scientific Python ecosystem, su... | Python Code:
import numpy as np
from matplotlib import pyplot as plt, cm
random_image = np.random.random([500, 500])
plt.imshow(random_image, cmap=cm.gray, interpolation='nearest');
Explanation: Images are numpy arrays
Images are represented in scikit-image using standard numpy arrays. This allows maximum inter-operab... |
10,775 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Computation of cutting planes
Step1: $\DeclareMathOperator{\domain}{dom}
\newcommand{\transpose}{\text{T}}
\newcommand{\vec}[1]{\begin{pmatrix}#1\end{pmatrix}}$
Example
To test the computat... | Python Code:
import numpy as np
import pandas as pd
import accpm
%load_ext autoreload
%autoreload 1
%aimport accpm
Explanation: Computation of cutting planes: example 1
The set-up
End of explanation
def funcobj(x):
return (x[0]-5)**2 + (x[1]-5)**2
def func0(x):
return x[0] - 20
def func1(x):
return -x[... |
10,776 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Exploring the MNIST Digits Dataset
Introduction
The MNIST digits dataset is a famous dataset of handwritten digit images. You can read more about it at wikipedia or Yann LeCun's page. It's a... | Python Code:
import pandas as pd
import matplotlib.pyplot as plt
import os
from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('MNIST original', data_home='datasets/')
# Convert sklearn 'datasets bunch' object to Pandas DataFrames
y = pd.Series(mnist.target).astype('int').astype('category')
X = pd.DataFrame(... |
10,777 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Basics of lists
Step1: The length of a list is acquired by the len functino
Step2: Lists can be initialised if its values are known at run time
Step3: Appending and extending lists
Step4:... | Python Code:
from __future__ import print_function
l1 = list()
l2 = []
print(l1)
print(l2)
Explanation: Basics of lists
End of explanation
print(len(l1))
print(len(l2))
Explanation: The length of a list is acquired by the len functino:
End of explanation
l3 = [1, 2, 3]
print(l3)
print(len(l3))
Explanation: Lists can b... |
10,778 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Decision Trees
By Parijat Mazumdar (GitHub ID
Step1: We want to create a decision tree from the above training dataset. The first step for that is to encode the data into numeric values and... | Python Code:
import os
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../../data')
# training data
train_income=['Low','Medium','Low','High','Low','High','Medium','Medium','High','Low','Medium',
'Medium','High','Low','Medium']
train_age = ['Old','Young','Old','Young','Old','Young','Young','Old','Old','Old','Young'... |
10,779 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Joint Intent Classification and Slot Filling with Transformers
The goal of this notebook is to fine-tune a pretrained transformer-based neural network model to convert a user query expressed... | Python Code:
import tensorflow as tf
tf.__version__
!nvidia-smi
# TODO: update this notebook to work with the latest version of transformers
%pip install -q transformers==2.11.0
Explanation: Joint Intent Classification and Slot Filling with Transformers
The goal of this notebook is to fine-tune a pretrained transformer... |
10,780 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Classifier analysis
In this notebook, I find the precision–recall and ROC curves of classifiers, and look at some examples of where the classifiers do really well (and really poorly).
... | Python Code:
import csv
import sys
import astropy.wcs
import h5py
import matplotlib.pyplot as plot
import numpy
import sklearn.metrics
sys.path.insert(1, '..')
import crowdastro.train
CROWDASTRO_H5_PATH = '../data/crowdastro.h5'
CROWDASTRO_CSV_PATH = '../crowdastro.csv'
TRAINING_H5_PATH = '../data/training.h5'
ARCMIN =... |
10,781 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
The API is very similar to the Gen2. We can butler.get with a dict of data IDs like before
Step1: We can get all data IDs/Dimensions.
Note that ref.dataId is no longer a simple dict; it's... | Python Code:
exp = butler.get("calexp", {"visit":903334, "detector":22, "instrument":"HSC"})
print(exp.getWcs())
wcs = butler.get("calexp.wcs", {"visit":903334, "detector":22, "instrument":"HSC"})
print(wcs)
vinfo = butler.get("calexp.visitInfo", {"visit":903334, "detector":22, "instrument":"HSC"})
print(vinfo)
Explana... |
10,782 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
https
Step1: Step 0 - hyperparams
Step2: Step 1 - collect data (and/or generate them)
Step3: Step 2 - Build model
Step4: Step 3 training the network
GRU cell
Step5: Conclusion
GRU has p... | Python Code:
from __future__ import division
import tensorflow as tf
from os import path
import numpy as np
import pandas as pd
import csv
from sklearn.model_selection import StratifiedShuffleSplit
from time import time
from matplotlib import pyplot as plt
import seaborn as sns
from mylibs.jupyter_notebook_helper impor... |
10,783 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Inverse Distance Verification
Step1: Generate random x and y coordinates, and observation values proportional to x * y.
Set up two test grid locations at (30, 30) and (60, 60).
Step2: Set ... | Python Code:
import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import cKDTree
from scipy.spatial.distance import cdist
from metpy.gridding.gridding_functions import calc_kappa
from metpy.gridding.interpolation import barnes_point, cressman_point
from metpy.gridding.triangles import dist_2
plt.rcPara... |
10,784 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Description
Time to make a simple SIP data simulation with the dataset that you alreadly created
Make sure you have created the dataset before trying to run this notebook
Setting variables
"... | Python Code:
workDir = '../../t/SIPSim_example/'
nprocs = 3
Explanation: Description
Time to make a simple SIP data simulation with the dataset that you alreadly created
Make sure you have created the dataset before trying to run this notebook
Setting variables
"workDir" is the path to the working directory for this an... |
10,785 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Fetching data from Infodengue
We can download the data from a full state. Let's pick Goiás.
Step2: Building the dashboard
Step3: Building Animated films
Step4: Downloading data
We will st... | Python Code:
go = get_alerta_table(state='GO', doenca='dengue')
go
municipios = geobr.read_municipality(code_muni='GO')
municipios
municipios['code_muni'] = municipios.code_muni.astype('int')
municipios.plot(figsize=(10,10));
goias = pd.merge(go.reset_index(), municipios,how='left', left_on='municipio_geocodigo', right... |
10,786 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
This exercise will get you started with running your own code.
Set up the notebook
To begin, run the code in the next cell.
- Begin by clicking inside the code cell.
- Click on the triangl... | Python Code:
# Set up the exercise
from learntools.core import binder
binder.bind(globals())
from learntools.intro_to_programming.ex1 import *
print('Setup complete.')
Explanation: This exercise will get you started with running your own code.
Set up the notebook
To begin, run the code in the next cell.
- Begin by cl... |
10,787 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Machine Learning Engineer Nanodegree
Unsupervised Learning
Project
Step1: Data Exploration
In this section, you will begin exploring the data through visualizations and code to understand h... | Python Code:
# Import libraries necessary for this project
import numpy as np
import pandas as pd
from IPython.display import display # Allows the use of display() for DataFrames
import matplotlib.pyplot as plt
# Import supplementary visualizations code visuals.py
import visuals as vs
# Pretty display for notebooks
%ma... |
10,788 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Logistic Regression with Grid Search (scikit-learn)
<a href="https
Step1: This example builds on our basic census income classification example by incorporating S3 data versioning.
Step2: ... | Python Code:
# restart your notebook if prompted on Colab
try:
import verta
except ImportError:
!pip install verta
Explanation: Logistic Regression with Grid Search (scikit-learn)
<a href="https://colab.research.google.com/github/VertaAI/modeldb/blob/master/client/workflows/demos/census-end-to-end-s3-example.ip... |
10,789 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Using cURL with Elasticsearch
The introductory documents and tutorials all use cURL (here after referred to by its command line name curl) to interact with Elasticsearch and demonstrate what... | Python Code:
%%bash
curl -XGET "http://search-01.ec2.internal:9200/"
Explanation: Using cURL with Elasticsearch
The introductory documents and tutorials all use cURL (here after referred to by its command line name curl) to interact with Elasticsearch and demonstrate what is possible and what is returned. Below is a s... |
10,790 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Interpreting numeric split points in H2O POJO tree based models
This notebook explains how to correctly interpret split points that you might see in POJOs of H2O tree based models.
Motivatio... | Python Code:
import numpy as np
f32 = np.float32("25.695312")
f32
f64 = np.float64("25.695312")
f64
Explanation: Interpreting numeric split points in H2O POJO tree based models
This notebook explains how to correctly interpret split points that you might see in POJOs of H2O tree based models.
Motivation: we had seen th... |
10,791 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Λ-Type Three-Level
Step2: Solve the Problem
Step3: Plot Output | Python Code:
mb_solve_json =
{
"atom": {
"fields": [
{
"coupled_levels": [[0, 1]],
"detuning": 0.0,
"label": "probe",
"rabi_freq": 1.0e-3,
"rabi_freq_t_args":
{
"ampl": 1.0,
"centre": 0.0,
"fwhm": 1.0
},
... |
10,792 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Introduction to the Research Environment
The research environment is powered by IPython notebooks, which allow one to perform a great deal of data analysis and statistical validation. We'll ... | Python Code:
2 + 2
Explanation: Introduction to the Research Environment
The research environment is powered by IPython notebooks, which allow one to perform a great deal of data analysis and statistical validation. We'll demonstrate a few simple techniques here.
Code Cells vs. Text Cells
As you can see, each cell can ... |
10,793 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Convolutional Networks
So far we have worked with deep fully-connected networks, using them to explore different optimization strategies and network architectures. Fully-connected net... | Python Code:
# As usual, a bit of setup
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.cnn import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient_array, eval_numerical_gradient
from cs231n.layers import *
from cs231n.fast_layers impo... |
10,794 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Section 2a
Our first look at the data will be focused on the time variations of the accidents
Step1: Read the dataframe
We have loaded in the SQL database the years 2010 to 2014. We can dir... | Python Code:
from CSVtoSQLconverter import load_sql_engine
sqlEngine = load_sql_engine()
import pandas as pd
import numpy as np
# Provides better color palettes
import seaborn as sns
from pandas import DataFrame,Series
import matplotlib as mpl
import matplotlib.pyplot as plt
# Command to display the plots in the iPytho... |
10,795 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Interactive Demo for Metrics
command line executables
Step1: Load trajectories
Step2: Load KITTI files with entries of the first three rows of $\mathrm{SE}(3)$ matrices per line (no timest... | Python Code:
from evo.tools import log
log.configure_logging()
from evo.tools import plot
from evo.tools.plot import PlotMode
from evo.core.metrics import PoseRelation, Unit
from evo.tools.settings import SETTINGS
# temporarily override some package settings
SETTINGS.plot_figsize = [6, 6]
SETTINGS.plot_split = True
SET... |
10,796 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Apply logistic regression to categorize whether a county had high mortality rate due to contamination
1. Import the necessary packages to read in the data, plot, and create a logistic regres... | Python Code:
import pandas as pd
%matplotlib inline
import numpy as np
from sklearn.linear_model import LogisticRegression
Explanation: Apply logistic regression to categorize whether a county had high mortality rate due to contamination
1. Import the necessary packages to read in the data, plot, and create a logistic ... |
10,797 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
resampling
does not have frequency and we want it
does not have the frequency we want
Step1: convert hourly to 45 min frequency and fill data
ffill --> forward fill --> use previous month d... | Python Code:
rng = pd.date_range('1/1/2011', periods=72, freq='H')
rng[1:4]
ts = pd.Series(list(range(len(rng))), index=rng)
ts.head()
Explanation: resampling
does not have frequency and we want it
does not have the frequency we want
End of explanation
converted = ts.asfreq('45Min', method='ffill')
converted.head(10)
t... |
10,798 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Non-linear recharge models
R.A. Collenteur, University of Graz
This notebook explains the use of the RechargeModel stress model to simulate the combined effect of precipitation and potential... | Python Code:
import pandas as pd
import pastas as ps
import matplotlib.pyplot as plt
ps.show_versions(numba=True)
ps.set_log_level("INFO")
Explanation: Non-linear recharge models
R.A. Collenteur, University of Graz
This notebook explains the use of the RechargeModel stress model to simulate the combined effect of preci... |
10,799 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Import important modules and declare important directories
Step1: This is a function that we'll use later to plot the results of a linear SVM classifier
Step2: Load in the sample JSON file... | Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib as mpl
import pandas as pd
import json
import pandas as pd
import csv
import os
import re
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn import svm
from sklearn.linear_model import SGDClassifie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.