Unnamed: 0 int64 0 16k | text_prompt stringlengths 110 62.1k | code_prompt stringlengths 37 152k |
|---|---|---|
15,800 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Lesson 1
Create Data - We begin by creating our own data set for analysis. This prevents the end user reading this tutorial from having to download any files to replicate the results below. ... | Python Code:
# Import all libraries needed for the tutorial
# General syntax to import specific functions in a library:
##from (library) import (specific library function)
from pandas import DataFrame, read_csv
# General syntax to import a library but no functions:
##import (library) as (give the library a nickname/a... |
15,801 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
This IPython notebook illustrates how to read the CSV files from disk as tables and set their metadata.
First, we need to import py_entitymatching package and other libraries as follows
Step... | Python Code:
import py_entitymatching as em
import pandas as pd
import os, sys
Explanation: This IPython notebook illustrates how to read the CSV files from disk as tables and set their metadata.
First, we need to import py_entitymatching package and other libraries as follows:
End of explanation
# Get the datasets dir... |
15,802 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<a href="https
Step1: Chapter 11
Step3: This could be the purpose of a function
Step5: If we execute the code above, we don't get any output. That's because we only told Python
Step8: 1.... | Python Code:
%%capture
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip
!wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip
!unzip Data.zip -d ../
!unzip images.zip -d .... |
15,803 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Regression Week 2
Step1: Load in house sales data
Dataset is from house sales in King County, the region where the city of Seattle, WA is located.
Step2: If we want to do any "feature engi... | Python Code:
import graphlab
graphlab.product_key.set_product_key("C0C2-04B4-D94B-70F6-8771-86F9-C6E1-E122")
Explanation: Regression Week 2: Multiple Regression (gradient descent)
In the first notebook we explored multiple regression using graphlab create. Now we will use graphlab along with numpy to solve for the regr... |
15,804 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Fitting Models Exercise 1
Imports
Step1: Fitting a quadratic curve
For this problem we are going to work with the following model
Step2: First, generate a dataset using this model using th... | Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize as opt
from IPython.html.widgets import interact
Explanation: Fitting Models Exercise 1
Imports
End of explanation
a_true = 0.5
b_true = 2.0
c_true = -4.0
Explanation: Fitting a quadratic curve
For this problem we a... |
15,805 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Rapid Overview
build intuition about pandas
details later
documentation
Step1: Basic series; default integer index
documentation
Step2: datetime index
documentation
Step3: sample NumPy da... | Python Code:
import pandas as pd
import numpy as np
Explanation: Rapid Overview
build intuition about pandas
details later
documentation: http://pandas.pydata.org/pandas-docs/stable/10min.html
End of explanation
my_series = pd.Series([1,3,5,np.nan,6,8])
my_series
Explanation: Basic series; default integer index
documen... |
15,806 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Предобработка данных и логистическая регрессия для задачи бинарной классификации
Programming assignment
В задании вам будет предложено ознакомиться с основными техниками предобработки данных... | Python Code:
import pandas as pd
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
matplotlib.style.use('ggplot')
%matplotlib inline
Explanation: Предобработка данных и логистическая регрессия для задачи бинарной классификации
Programming assignment
В задании вам будет предложено ознакомиться с ... |
15,807 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: PWC-Net-small model finetuning (with cyclical learning rate schedule)
In this notebook we
Step2: TODO
Step3: Finetune on FlyingChairs+FlyingThings3DHalfRes mix
Load the dataset
Step... | Python Code:
pwcnet_finetune.ipynb
PWC-Net model finetuning.
Written by Phil Ferriere
Licensed under the MIT License (see LICENSE for details)
Tensorboard:
[win] tensorboard --logdir=E:\\repos\\tf-optflow\\tfoptflow\\pwcnet-sm-6-2-cyclic-chairsthingsmix_finetuned
[ubu] tensorboard --logdir=/media/EDrive/repos/t... |
15,808 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Critical Radii
Step1: As always, let's do imports and initialize a logger and a new Bundle. See Building a System for more details.
Step2: Detached Systems
Detached systems are the defaul... | Python Code:
!pip install -I "phoebe>=2.1,<2.2"
Explanation: Critical Radii: Detached Systems
Setup
Let's first make sure we have the latest version of PHOEBE 2.1 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
%matp... |
15,809 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Load Truth Data
Our uruguay data comes in a csv format. It contains three attributes
Step1: Label distribution
In this section, data is binned by landcover and counted. Landcover classes wi... | Python Code:
df = pd.read_csv('../data.csv')
df.head()
Explanation: Load Truth Data
Our uruguay data comes in a csv format. It contains three attributes:
latitude
longitude
landcover class
End of explanation
df.groupby("LandUse").size()
fig, ax = pyplot.subplots(figsize=(15,3))
sns.countplot(x="LandUse",data=df, pale... |
15,810 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2021 The TensorFlow Authors.
Step1: Transfer Learning for the Audio Domain with TensorFlow Lite Model Maker
<table class="tfo-notebook-buttons" align="left">
<td>
<a target=... | Python Code:
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# dist... |
15,811 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
In this tutorial I’ll explain how to build a simple working
Recurrent Neural Network in TensorFlow!
We will build a simple Echo-RNN that remembers the input sequence and then echoes it aft... | Python Code:
from IPython.display import Image
from IPython.core.display import HTML
from __future__ import print_function, division
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
Image(url= "https://cdn-images-1.medium.com/max/1600/1*UkI9za9zTR-HL8uM15Wmzw.png")
#hyperparams
num_epochs = 1... |
15,812 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Examples of Boolean operators
Think about
Step2: Thinking about how results work
Look at truth tables to understand how values can be combined for these binary operators
Step5: Black Jack
... | Python Code:
True and False
True or False and False
False and False
print((True or False) and False)
print(True or (False and False))
print(not False)
print(not True)
Explanation: Examples of Boolean operators
Think about:
What operators exist
What these operators can be used on
The precedence of these operators
End o... |
15,813 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Title
Step1: The Scenario
Imagine we have a function that takes in some external API or database and we want to test that function, but with fake (or mocked) inputs. The Python mock library... | Python Code:
import unittest
import mock
from math import exp
Explanation: Title: Mocking Functions
Slug: mocking_functions
Summary: Mocking Functions in Python.
Date: 2016-01-23 12:00
Category: Python
Tags: Testing
Authors: Chris Albon
Interesting in learning more? Here are some good books on unit testing in Python... |
15,814 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Merge
Concat
Join
Append
Step1: concat()
documentation
Step2: concatenate first and last elements
append()
documentation | Python Code:
import pandas as pd
import numpy as np
starting_date = '20160701'
sample_numpy_data = np.array(np.arange(24)).reshape((6,4))
dates_index = pd.date_range(starting_date, periods=6)
sample_df = pd.DataFrame(sample_numpy_data, index=dates_index, columns=list('ABCD'))
sample_df_2 = sample_df.copy()
sample_df_2[... |
15,815 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Systemic Velocity
NOTE
Step1: As always, let's do imports and initialize a logger and a new Bundle. See Building a System for more details.
Step2: Now we'll create empty lc, rv, orb, and ... | Python Code:
!pip install -I "phoebe>=2.1,<2.2"
%matplotlib inline
Explanation: Systemic Velocity
NOTE: the definition of the systemic velocity has been flipped between 2.0.x and 2.1.0+ to adhere to usual conventions. If importing a file from PHOEBE 2.0.x, the value should be flipped automatically, but if adopting an ... |
15,816 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Google form analysis tests
Table of Contents
'Google form analysis' functions checks
Google form loading
Selection of a question
Selection of a user's answers
checking answers
comparison of ... | Python Code:
%run "../Functions/2. Google form analysis.ipynb"
# Localplayerguids of users who answered the questionnaire (see below).
# French
#localplayerguid = 'a4d4b030-9117-4331-ba48-90dc05a7e65a'
#localplayerguid = 'd6826fd9-a6fc-4046-b974-68e50576183f'
#localplayerguid = 'deb089c0-9be3-4b75-9b27-28963c77b10c'
#l... |
15,817 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Generate Reactions
This script performs the same task as the script in scripts/generateReactions.py but in visual ipynb format.
It can also evaluate the reaction forward and reverse rates at... | Python Code:
from rmgpy.rmg.main import RMG
from rmgpy.rmg.model import CoreEdgeReactionModel
from rmgpy import settings
from IPython.display import display
from rmgpy.cantherm.output import prettify
Explanation: Generate Reactions
This script performs the same task as the script in scripts/generateReactions.py but in ... |
15,818 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Day 14
Step1: Hash index
To prevent the same hash from being counted upon again and again, we maintain a hash index to store the hashes of indexes. We also trim the index to remove any inde... | Python Code:
import re
three_repeating_characters = re.compile(r'(.)\1{2}')
with open('../inputs/day14.txt', 'r') as f:
salt = f.readline().strip()
# TEST DATA
# salt = 'abc'
print(salt)
Explanation: Day 14: One-Time Pad
author: Harshvardhan Pandit
license: MIT
link to problem statement
In order to communic... |
15,819 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Class 10
ML Techniques
Step1: There are a number of different features here. We'll focus on the first two
Step2: Standarization scaling
As we noted above, the goal is to turn these feature... | Python Code:
import pandas as pd
df = pd.read_csv('Class10_wine_data.csv')
df.head()
Explanation: Class 10
ML Techniques: Feature scaling
Another aspect of optimizing machine learning algorithms is to think about feature scaling. When we use multiple numeric features as inputs to a regression or classification algorith... |
15,820 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Project 2
Step1: 1. Murder rates
Punishment for crime has many philosophical justifications. An important one is that fear of punishment may deter people from committing crimes.
In the Uni... | Python Code:
# Run this cell to set up the notebook, but please don't change it.
import numpy as np
from datascience import *
# These lines do some fancy plotting magic.
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
import warnings
warnings.simplefilter('ignore', ... |
15,821 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Expressions
Rational expressions, or expressions for short, denote (rational) languages in a compact way. Since Vcsn supports weighted expressions, they actually can denoted rational series... | Python Code:
import vcsn
import pandas as pd
pd.options.display.max_colwidth = 0
Explanation: Expressions
Rational expressions, or expressions for short, denote (rational) languages in a compact way. Since Vcsn supports weighted expressions, they actually can denoted rational series.
This page documents the syntax and... |
15,822 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Distributed training with TensorFlow
Learning Objectives
1. Create MirroredStrategy
2. Integrate tf.distribute.Strategy with tf.keras
3. Create the input dataset and call tf.distribute... | Python Code:
# Import TensorFlow
import tensorflow as tf
Explanation: Distributed training with TensorFlow
Learning Objectives
1. Create MirroredStrategy
2. Integrate tf.distribute.Strategy with tf.keras
3. Create the input dataset and call tf.distribute.Strategy.experimental_distribute_dataset
Introduction
tf.di... |
15,823 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Problem 1
Random images
Step1: Problem 2
Mean images
Step2: Problem 3
Randomize data
Step3: Problem 4
Number per class
Step4: OK, so there are about 50000 in each class in the training s... | Python Code:
label_map = list('abcdefghij')
fig,axes = pl.subplots(3,3,figsize=(5,5),sharex=True,sharey=True)
with h5py.File(cache_file, 'r') as f:
for i in range(9):
ax = axes.flat[i]
idx = np.random.randint(f['test']['images'].shape[0])
ax.imshow(f['test']['images'][idx],
... |
15,824 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Loopless FBA
The goal of this procedure is identification of a thermodynamically consistent flux state without loops, as implied by the name.
Usually, the model has the following constraints... | Python Code:
%matplotlib inline
import plot_helper
import cobra.test
from cobra import Reaction, Metabolite, Model
from cobra.flux_analysis.loopless import construct_loopless_model
from cobra.flux_analysis import optimize_minimal_flux
from cobra.solvers import get_solver_name
Explanation: Loopless FBA
The goal of this ... |
15,825 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Warsztaty modelowania w nanofizyce
Zachowania atomów w zależności od ich rodzaju i położenia
Paweł T. Jochym
Zakład Komputerowych Badań Materiałów
Instytut Fizyki Jądrowej PAN, Kraków
Analiz... | Python Code:
# Import potrzebnych modułów
%matplotlib inline
import numpy as np
from ase import Atoms, units
import ase.io
from ase.io.trajectory import Trajectory
from ipywidgets import HBox, VBox, Checkbox, Dropdown, IntSlider, FloatSlider
from io import BytesIO
import nglview
import glob
def recenter(a):
'''
... |
15,826 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Fidelio demo notebook
Step1: Choose an alphabet
Before sending any messages, we must agree on a way to represent characters as numbers.
Fidelio comes with 3 pre-defined character encodings
... | Python Code:
from fidelio_functions import *
Explanation: Fidelio demo notebook
End of explanation
print(ALL_CAPS)
for key, val in sorted(char_to_num(ALL_CAPS).items()):
print(key,val)
Explanation: Choose an alphabet
Before sending any messages, we must agree on a way to represent characters as numbers.
Fidelio com... |
15,827 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Data analysis in Python with pandas
What is pandas?
pandas
Step1: How do I read a tabular data file into pandas?
Tabular data file
Step2: Tip
Step3: Tip
Step4: Why do some pandas command... | Python Code:
import pandas as pd
Explanation: Data analysis in Python with pandas
What is pandas?
pandas: Open source library in Python for data analysis, data manipulation, and data visualisation.
Pros:
1. Tons of functionality
2. Well supported by community
3. Active development
4. Lot of documentation
5. Plays well ... |
15,828 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Acme
Step2: Install dm_control
The next cell will install environments provided by dm_control if you have an institutional MuJoCo license. This is not necessary, but without this you won't ... | Python Code:
#@title Install necessary dependencies.
!sudo apt-get install -y xvfb ffmpeg
!pip install 'gym==0.10.11'
!pip install imageio
!pip install PILLOW
!pip install 'pyglet==1.3.2'
!pip install pyvirtualdisplay
!pip install dm-acme
!pip install dm-acme[reverb]
!pip install dm-acme[tf]
!pip install dm-acme[envs]
... |
15,829 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
I've seen a couple of nice kernels here, but no one explained the importance of a morphological pre-processing of the data. So I decided to compare two approaches of a morphological normaliz... | Python Code:
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.stem import LancasterStemmer
stemmer = LancasterStemmer()
lemmer = WordNetLemmatizer()
Explanation: I've seen a couple of nice kernels here, but no one explained the importance of a morphological pre-processing of the data. So I decided to compare ... |
15,830 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Collapsed Gibbs sampler for supervised latent Dirichlet allocation
<div style="display
Step1: Generate topics
We assume a vocabulary of 25 terms, and create ten "topics", where each topic a... | Python Code:
%matplotlib inline
from modules.helpers import plot_images
from functools import partial
from sklearn.metrics import (mean_squared_error)
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
imshow = partial(plt.imshow, cmap='gray', interpolation='nearest', aspect='auto')
rmse = lambda ... |
15,831 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
$A(t,T) = \Sigma_i A_i e^{-t/\tau_i} / (1 + e^{-T/2\tau_i})$
Step1: Simple exponential basis
$$ \mathbf{A}\mathbf{\alpha} = \mathbf{d}$$ | Python Code:
def AofT(time,T, ai, taui):
return ai*np.exp(-time/taui)/(1.+np.exp(-T/(2*taui)))
from SimPEG import *
import sys
sys.path.append("./DoubleLog/")
from plotting import mapDat
class LinearSurvey(Survey.BaseSurvey):
nD = None
def __init__(self, time, **kwargs):
self.time = time
se... |
15,832 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Permutation t-test on source data with spatio-temporal clustering
This example tests if the evoked response is significantly different between
two conditions across subjects. Here just for d... | Python Code:
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
import os.path as op
import numpy as np
from numpy.random import randn
from scipy import stats as stats
import mne
from mne.epochs import equalize_epoch_counts
from mne.sta... |
15,833 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Another Phi Identity
Developed from an email from D. B. Koski.
David writes, referring to his stumbling across the Fibonaccis left of zero
Step1: Lets evaluate the individual terms on eithe... | Python Code:
import math
import gmpy2
gmpy2.get_context().precision=200
def fibo(a=0, b=1):
while True:
yield a
a, b = b, a + b
fib_gen = fibo()
print("SEQ1:",[next(fib_gen) for _ in range(10)])
fib_gen = fibo(2, -1)
print("SEQ2:",[next(fib_gen) for _ in range(10)])
coeff0 = fibo()
coeff1 =... |
15,834 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Huge Monty Hall Bayesian Network
authors
Step1: We'll create the discrete distribution for our friend first.
Step2: The emissions for our guest are completely random.
Step3: Then the dist... | Python Code:
import math
from pomegranate import *
Explanation: Huge Monty Hall Bayesian Network
authors:<br>
Jacob Schreiber [<a href="mailto:jmschreiber91@gmail.com">jmschreiber91@gmail.com</a>]<br>
Nicholas Farn [<a href="mailto:nicholasfarn@gmail.com">nicholasfarn@gmail.com</a>]
Lets expand the Bayesian network for... |
15,835 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
리스트 공부할때 fruits라는 리스트 이름에 과일을 저장했어요.
이제 하나하나의 과일을 출력해 봅시다.
Step1: 사과, 바나나, 체리 순서로 출력이 됩니다.
for 다음에 한칸 띄우고 x라는 이름을 썼어요. 이건 아무거나 써도 되요 abc 이렇게 써도 되요
그리고 in 다음에 위의 리스트 fruits를 썼어요. 다시 해볼까요 ?
... | Python Code:
fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)
Explanation: 리스트 공부할때 fruits라는 리스트 이름에 과일을 저장했어요.
이제 하나하나의 과일을 출력해 봅시다.
End of explanation
fruits = ["apple", "banana", "cherry"]
for abc in fruits:
print(x)
Explanation: 사과, 바나나, 체리 순서로 출력이 됩니다.
for 다음에 한칸 띄우고 x라는 이름을 썼어요. 이건 아무거나 써도 되요... |
15,836 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Please find torch implementation of this notebook here
Step3: Data
We use the Penn Tree Bank (PTB), which is a small but commonly-used corpus derived from the Wall Stree Journal.
Step6: We... | Python Code:
import numpy as np
import matplotlib.pyplot as plt
import math
import os
import random
random.seed(0)
import jax
import jax.numpy as jnp
try:
from flax import linen as nn
except ModuleNotFoundError:
%pip install -qq flax
from flax import linen as nn
from flax.training import train_state
try:
... |
15,837 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Intro to python
Basic commands
Hello and welcome to the wonderful world of Python. Each of these cells can be copy and pasted into your own notebook. There are code cells and text cells. The... | Python Code:
# This line is a comment -- it does nothing
# you can add comments using the '#' symbol
Explanation: Intro to python
Basic commands
Hello and welcome to the wonderful world of Python. Each of these cells can be copy and pasted into your own notebook. There are code cells and text cells. The code cells exec... |
15,838 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementat... | Python Code:
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of t... |
15,839 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Combining Filters
Like factors, filters can be combined. Combining filters is done using the & (and) and | (or) operators. For example, let's say we want to screen for securities that ar... | Python Code:
dollar_volume = AverageDollarVolume(window_length=30)
high_dollar_volume = dollar_volume.percentile_between(90, 100)
Explanation: Combining Filters
Like factors, filters can be combined. Combining filters is done using the & (and) and | (or) operators. For example, let's say we want to screen for secur... |
15,840 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Crossentropy method
This notebook will teach you to solve reinforcement learning problems with crossentropy method. We'll follow-up by scaling everything up and using neural network policy.
... | Python Code:
# In Google Colab, uncomment this:
# !wget https://bit.ly/2FMJP5K -O setup.py && bash setup.py
# XVFB will be launched if you run on a server
import os
if type(os.environ.get("DISPLAY")) is not str or len(os.environ.get("DISPLAY")) == 0:
!bash ../xvfb start
os.environ['DISPLAY'] = ':1'
import gym
i... |
15,841 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<a href="http
Step1: Functions used to plot
Step2: Create the dataset class
Step3: <!--Empty Space for separating topics-->
<h2 id="Model">Neural Network Module and Function for Training<... | Python Code:
# Import the libraries for this lab
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from matplotlib.colors import ListedColormap
from torch.utils.data import Dataset, DataLoader
torch.manual_seed(1)
np.random.seed(1)
Explanation: <a hre... |
15,842 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Land
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specify do... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-2', 'land')
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetat... |
15,843 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Calculating correlation functions
This document walks through using Py2PAC to calculate correlation functions with or without error estimates. We'll do this with the AngularCatalog class.
F... | Python Code:
import AngularCatalog_class as ac
import numpy.random as rand
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (10, 6)
Explanation: Calculating correlation functions
This document walks through using Py2PAC to calculate correlation functions with or without error estimat... |
15,844 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Plot some left, center and right images
Step1: Plot the same images but crop to remove the sky and car bonnet
Step2: Same images but resized
Step3: Converted to HSV colour space and showi... | Python Code:
from keras.preprocessing.image import img_to_array, load_img
plt.rcParams['figure.figsize'] = (12, 6)
i = 0
for camera in ["left", "center", "right"]:
image = load_img("data/"+data_frame.iloc[1090][camera].strip())
image = img_to_array(image).astype(np.uint8)
plt.subplot(1, 3, i+1)
plt.imsh... |
15,845 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Toplevel
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specif... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-esm2-hr5', 'toplevel')
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CMCC
Source ID: CMCC-ESM2-HR5
Sub-Topics: Radiative Forcings.
Prop... |
15,846 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Anna KaRNNa
In this notebook, we'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book... | Python Code:
import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
Explanation: Anna KaRNNa
In this notebook, we'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network... |
15,847 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Examples and Exercises from Think Stats, 2nd Edition
http
Step1: Again, I'll load the NSFG pregnancy file and select live births
Step2: Here's the histogram of birth weights
Step3: To nor... | Python Code:
from __future__ import print_function, division
%matplotlib inline
import numpy as np
import nsfg
import first
import thinkstats2
import thinkplot
Explanation: Examples and Exercises from Think Stats, 2nd Edition
http://thinkstats2.com
Copyright 2016 Allen B. Downey
MIT License: https://opensource.org/lice... |
15,848 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Time-average EM Cubes
Calculate the time-averaged emission measure distributions from the exact thermodynamic results and save them to be easily reloaded and used later.
Step1: Iterate over... | Python Code:
import os
import io
import copy
import glob
import urllib
import numpy as np
import h5py
import matplotlib.pyplot as plt
import matplotlib.colors
import seaborn as sns
import astropy.units as u
import astropy.constants as const
from scipy.ndimage import gaussian_filter
from sunpy.map import Map,GenericMap
... |
15,849 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Tracking the Smoke Caused by the fires
In this example we show how to use HRRR Smoke Experimental dataset to analyse smoke in the US and we will also download historical fire data from Cal F... | Python Code:
%matplotlib notebook
%matplotlib inline
import numpy as np
import dh_py_access.lib.datahub as datahub
import xarray as xr
import matplotlib.pyplot as plt
import ipywidgets as widgets
from mpl_toolkits.basemap import Basemap,shiftgrid
import dh_py_access.package_api as package_api
import matplotlib.colors a... |
15,850 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<div align="right">Python 3.6 Jupyter Notebook</div>
Network analysis using NetworkX
<div class="alert alert-warning">
<b>This notebook contains advanced exercises that are only applicable t... | Python Code:
# Load the relevant libraries to your notebook.
import pandas as pd # Processing csv files and manipulating the DataFrame.
import networkx as nx # Graph-like object representation and manipulation module.
import matplotlib.pylab as plt # Plotting and data visualization module.
... |
15,851 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Convolutional Autoencoder
Sticking with the MNIST dataset, let's improve our autoencoder's performance using convolutional layers. Again, loading modules and the data.
Step1: Network Archit... | 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)
img = mnist.train.images[2]
plt.imshow(img.reshape((28, 28)), cmap='Greys_r')
Explanati... |
15,852 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Self-Driving Car Engineer Nanodegree
Deep Learning
Project
Step1: Step 1
Step2: Visualize the German Traffic Signs Dataset using the pickled file(s). This is open ended, suggestions includ... | Python Code:
# Load pickled data
import pickle
# TODO: Fill this in based on where you saved the training and testing data
training_file = './traffic-signs-data/train.p'
testing_file = './traffic-signs-data/test.p'
with open(training_file, mode='rb') as f:
train = pickle.load(f)
with open(testing_file, mode='rb') a... |
15,853 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Semantic text search using embeddings
We can search through all our reviews semantically in a very efficient manner and at very low cost, by simply embedding our search query, and then findi... | Python Code:
import pandas as pd
import numpy as np
df = pd.read_csv('output/embedded_1k_reviews.csv')
df['babbage_search'] = df.babbage_search.apply(eval).apply(np.array)
Explanation: Semantic text search using embeddings
We can search through all our reviews semantically in a very efficient manner and at very low cos... |
15,854 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
In this tutorial we'll demonstrate Coach's hierarchical RL support, by building a new agent that implements the Hierarchical Actor Critic (HAC) algorithm (https
Step1: Now let's define the ... | Python Code:
import os
import sys
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path:
sys.path.append(module_path)
sys.path.append(module_path + '/rl_coach')
from typing import Union
import numpy as np
from rl_coach.agents.ddpg_agent import DDPGAgent, DDPGAgentParameters, DDPG... |
15,855 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Genotype data in FAPS
Tom Ellis, March 2017
In most cases, researchers will have a sample of offspring, maternal and candidate paternal individuals typed at a set of markers. In this section... | Python Code:
import faps as fp
import numpy as np
allele_freqs = np.random.uniform(0.3,0.5,10)
mypop = fp.make_parents(5, allele_freqs, family_name='my_population')
Explanation: Genotype data in FAPS
Tom Ellis, March 2017
In most cases, researchers will have a sample of offspring, maternal and candidate paternal indivi... |
15,856 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Sample Notebook 2 for Picasso
This notebook shows some basic interaction with the picasso library. It assumes to have a working picasso installation. To install jupyter notebooks in a conda ... | Python Code:
from picasso import io
path = 'testdata_locs.hdf5'
locs, info = io.load_locs(path)
print('Loaded {} locs.'.format(len(locs)))
Explanation: Sample Notebook 2 for Picasso
This notebook shows some basic interaction with the picasso library. It assumes to have a working picasso installation. To install jupyter... |
15,857 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
State observer examples
This notebook relies on the Python code stored in the folder python.
Step1: Exponential decay scalar case
This section shows the exponential decay at different rate.... | Python Code:
#Import base libraries
import numpy as np
import matplotlib.pyplot as plt
import random
from matplotlib import animation, rc
from IPython.display import HTML
import importlib
# Import libraries for the examples
import os
import sys
module_path = os.path.abspath(os.path.join('../python'))
if module_path not... |
15,858 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Structures like these are encoded in "PDB" files
Entries are determined by columns in the file, not by spaces between the columns
Step1: Predict what the following will do
Step2: Write a p... | Python Code:
#record atom_name chain x y z occupancy atom_type
# | | | | | | | |
#ATOM 1086 CG LYS A 141 -4.812 9.683 2.584 1.00 26.78 N0
# | | | ... |
15,859 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Think Bayes
This notebook presents example code and exercise solutions for Think Bayes.
Copyright 2018 Allen B. Downey
MIT License
Step3: The World Cup Problem, Part One
In the 2014 FIFA Wo... | Python Code:
# Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# import classes from thinkbayes2
from thinkbayes2 import Pmf, Cdf, Suite
import thinkbayes2
i... |
15,860 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Accessing Simulation data directly
The Python interface also allows users to access simulation data directly, without requiring file output. In this notebook we repeat the "Two Stream" insta... | Python Code:
# Using spectral EM1D code
import em1ds as zpic
import numpy as np
nx = 120
box = 4 * np.pi
dt = 0.08
tmax = 50.0
ppc = 500
ufl = [0.4, 0.0, 0.0]
uth = [0.001,0.001,0.001]
right = zpic.Species( "right", -1.0, ppc, ufl = ufl, uth = uth )
ufl[0] = -ufl[0]
left = zpic.Species( "left", -1.0, ppc, ufl = uf... |
15,861 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: XEB calibration
Step2: Select qubits
First we select a processor and calibration metric(s) to visualize the latest calibration report.
Note
Step3: Using this report as a guide, we s... | Python Code:
try:
import cirq
except ImportError:
!pip install --quiet cirq --pre
# The Google Cloud Project id to use.
project_id = "" #@param {type:"string"}
processor_id = "" #@param {type:"string"}
from cirq_google.engine.qcs_notebook import get_qcs_objects_for_notebook
device_sampler = get_qcs_objects_for_... |
15,862 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Seaice
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', 'nims-kma', 'sandbox-1', 'seaice')
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: NIMS-KMA
Source ID: SANDBOX-1
Topic: Seaice
Sub-Topics: Dynamics, Therm... |
15,863 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Загрузим данные
Step1: Зафиксируем генератор случайных чисел для воспроизводимости
Step2: Домашка!
Разделим данные на условно обучающую и отложенную выборки
Step3: Измерять качество будем... | Python Code:
from sklearn.datasets import load_boston
bunch = load_boston()
print(bunch.DESCR)
X, y = pd.DataFrame(data=bunch.data, columns=bunch.feature_names.astype(str)), bunch.target
X.head()
Explanation: Загрузим данные
End of explanation
SEED = 22
np.random.seed = SEED
Explanation: Зафиксируем генератор случайных... |
15,864 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Discrete Random Variables and Sampling
George Tzanetakis, University of Victoria
In this notebook we will explore discrete random variables and sampling. After defining a helper class and as... | Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
from scipy import stats
import numpy as np
class Random_Variable:
def __init__(self, name, values, probability_distribution):
self.name = name
self.values = values
self.probability_distribution = probability_distribut... |
15,865 | Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
pandas version: 1.2 | Problem:
import pandas as pd
df = pd.DataFrame([(.21, .3212), (.01, .61237), (.66123, .03), (.21, .18),(pd.NA, .18)],
columns=['dogs', 'cats'])
def g(df):
df['dogs'] = df['dogs'].apply(lambda x: round(x,2) if str(x) != '<NA>' else x)
return df
df = g(df.copy()) |
15,866 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Double Multiple Stripe Analysis (2MSA) for Single Degree of Freedom (SDOF) Oscillators
<img src="../../../../figures/intact-damaged.jpg" width="500" align="middle">
Step1: Load capacity cur... | Python Code:
from rmtk.vulnerability.common import utils
import double_MSA_on_SDOF
import numpy
from rmtk.vulnerability.derivation_fragility.NLTHA_on_SDOF.read_pinching_parameters import read_parameters
import MSA_utils
%matplotlib inline
Explanation: Double Multiple Stripe Analysis (2MSA) for Single Degree of Freedom ... |
15,867 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<img style="float
Step1: Let us take a sneak peek at the data
Step2: What is the size of the dataset?
Step3: Now we see that there are different models of hard disks, let us list them
<im... | Python Code:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
%matplotlib inline
plt.style.use('ggplot')
plt.rcParams['figure.figsize']=15,10
df = pd.read_csv('data/data.csv')
Explanation: <img style="float:center" src="img/explore.jpg" width=300/>
Exploring the data
When we ... |
15,868 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Fully-Connected Neural Nets
In the previous homework you implemented a fully-connected two-layer neural network on CIFAR-10. The implementation was simple but not very modular since t... | Python Code:
# As usual, a bit of setup
import time
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.fc_net import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from cs231n.solver import Solver
%matplot... |
15,869 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Repeated Games With Mistakes
Nikolas Skoufis, 23/10/15
Supervisor
Step1: All strategies inherit from a base Strategy class
Arbitrary strategies can be simulated, including non-deterministic... | Python Code:
from repeatedmistakes.strategies import SuspiciousTitForTat, TitForTat
from repeatedmistakes.repeatedgame import RepeatedGame
my_game = RepeatedGame(SuspiciousTitForTat, TitForTat)
simulation_results = my_game.simulate(10)
print("STFT: " + str(simulation_results[SuspiciousTitForTat]))
print("TFT: " + str(s... |
15,870 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<font color=Teal>ATOMIC and ASTRING FUNCTIONS (Python Code)</font>
By Sergei Yu. Eremenko, PhD, Dr.Eng., Professor, Honorary Professor
https
Step1: <font color=teal>2. Atomic String Functio... | Python Code:
import numpy as np
import pylab as pl
pl.rcParams["figure.figsize"] = 9,6
###################################################################
##This script calculates the values of Atomic Function up(x) (1971)
###################################################################
################### One Pulse... |
15,871 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Метод главных компонент
В данном задании вам будет предложено ознакомиться с подходом, который переоткрывался в самых разных областях, имеет множество разных интерпретаций, а также несколько... | Python Code:
import numpy as np
import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
matplotlib.style.use('ggplot')
import seaborn as sns
%matplotlib inline
Explanation: Метод главных компонент
В данном задании вам будет предложено ознакомиться с подходом, кот... |
15,872 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Plotting
There are many libraries for plotting in Python. The standard library is matplotlib. Its examples and gallery are particularly useful references.
Matplotlib is most useful if you ha... | Python Code:
%matplotlib inline
Explanation: Plotting
There are many libraries for plotting in Python. The standard library is matplotlib. Its examples and gallery are particularly useful references.
Matplotlib is most useful if you have data in numpy arrays. We can then plot standard single graphs straightforwardly:
E... |
15,873 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
What is MSE about?
MSE or Maximum Square Estimation is about maximizing the geometric mean of spacings in the data. Such spacings are the differences between the values of the cumulative dis... | Python Code:
import numpy as np
from scipy.stats.mstats import gmean
from scipy.stats import pareto
import matplotlib.pyplot as plt
print plt.style.available
plt.style.use('ggplot')
#this is the real shape parameter that we will try to approximate with the estimators
realAlpha=3.
#the left limit of this Pareto distribu... |
15,874 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Implementing Lemke-Howson in Python
Daisuke Oyama
Faculty of Economics, University of Tokyo
Step1: To be consistent with the 0-based indexing in Python,
we call the players 0 and 1.
Complem... | Python Code:
import numpy as np
np.set_printoptions(precision=5) # Reduce the number of digits printed
A = np.array([[3, 3],
[2, 5],
[0 ,6]])
B_T = np.array([[3, 2, 3],
[2, 6, 1]])
m, n = A.shape # Numbers of actions of the players
Explanation: Implementing Lemke-Howson in ... |
15,875 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Genetic Home Reference Data linking
The Genetic Home Reference is an NLM resource and can be found at https
Step2: Update Wikidata with corresponding information
Identify the db iden... | Python Code:
from wikidataintegrator import wdi_core, wdi_login, wdi_helpers
from wikidataintegrator.ref_handlers import update_retrieved_if_new_multiple_refs
import pandas as pd
from pandas import read_csv
import requests
from tqdm.notebook import trange, tqdm
import ipywidgets
import widgetsnbextension
import xml.et... |
15,876 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Dual CRISPR Screen Analysis
Step 2
Step1: Automated Set-Up
Step2: Construct Filtering Functions | Python Code:
g_num_processors = 3
g_trimmed_fastqs_dir = '~/dual_crispr/test_data/test_set_2'
g_filtered_fastqs_dir = '~/dual_crispr/test_outputs/test_set_2'
g_min_trimmed_grna_len = 19
g_max_trimmed_grna_len = 21
g_len_of_seq_to_match = 19
Explanation: Dual CRISPR Screen Analysis
Step 2: Construct Filter
Amanda Birmin... |
15,877 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Week 1 - Getting Started
Step1: Python Summary
Further information
More information is usually available with the help function. Using ? brings up the same information in ipython.
Using th... | Python Code:
import numpy as np
print("Numpy:", np.__version__)
Explanation: Week 1 - Getting Started
End of explanation
location = 'Bethesda'
zip_code = 20892
elevation = 71.9
print("We're in", location, "zip code", zip_code, ", ", elevation, "m above sea level")
print("We're in " + location + " zip code " + str(zip_c... |
15,878 | 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', 'nerc', 'sandbox-3', 'aerosol')
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: NERC
Source ID: SANDBOX-3
Topic: Aerosol
Sub-Topics: Transport, Emissions... |
15,879 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Steps to use the TF Experiment APIs
Define dataset metadata
Define data input function to read the data from .tfrecord files + feature processing
Create TF feature columns based on metadata ... | Python Code:
MODEL_NAME = 'class-model-02'
TRAIN_DATA_FILES_PATTERN = 'data/train-*.csv'
VALID_DATA_FILES_PATTERN = 'data/valid-*.csv'
TEST_DATA_FILES_PATTERN = 'data/test-*.csv'
RESUME_TRAINING = False
PROCESS_FEATURES = True
EXTEND_FEATURE_COLUMNS = True
MULTI_THREADING = True
Explanation: Steps to use the TF Experim... |
15,880 | Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
Having a pandas data frame as follow: | Problem:
import pandas as pd
df = pd.DataFrame({'a':[1,1,1,2,2,2,3,3,3], 'b':[12,13,23,22,23,24,30,35,55]})
import numpy as np
def g(df):
softmax = []
min_max = []
for i in range(len(df)):
Min = np.inf
Max = -np.inf
exp_Sum = 0
for j in range(len(df)):
if df.loc[i... |
15,881 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<div align="center"><h1>Vector Add on GPU</h1></div>
Vector Add
In the world of computing, the addition of two vectors is the standard "Hello World".
Given two sets of scalar data, such as ... | Python Code:
!hybridizer-cuda ./01-vector-add/01-vector-add.cs -o ./01-vector-add/vectoradd.exe -run
Explanation: <div align="center"><h1>Vector Add on GPU</h1></div>
Vector Add
In the world of computing, the addition of two vectors is the standard "Hello World".
Given two sets of scalar data, such as the image above,... |
15,882 | 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... |
15,883 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
GitHub - Data Extraction
The file ../data/RPackage-Repositories-150101-150601.csv contains a list of GitHub repositories that are candidates to store a package related to R. Those candidates... | Python Code:
import pandas
from datetime import date
Explanation: GitHub - Data Extraction
The file ../data/RPackage-Repositories-150101-150601.csv contains a list of GitHub repositories that are candidates to store a package related to R. Those candidates were collected from the activity on GitHub between 15-01 and 15... |
15,884 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Once you've trained a model, you might like to get more information about how it performs on the various targets you asked it to predict.
To run this tutorial, you'll need to either download... | Python Code:
model_file = '../data/models/pretrained_model.th'
seqs_file = '../data/encode_roadmap.h5'
Explanation: Once you've trained a model, you might like to get more information about how it performs on the various targets you asked it to predict.
To run this tutorial, you'll need to either download the pre-train... |
15,885 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Dual CRISPR Screen Analysis
Construct Scaffold Trimming
Amanda Birmingham, CCBB, UCSD (abirmingham@ucsd.edu)
Instructions
To run this notebook reproducibly, follow these steps
Step1: CCBB L... | Python Code:
g_num_processors = 3
g_fastqs_dir = '/Users/Birmingham/Repositories/ccbb_tickets/20160210_mali_crispr/data/raw/20160504_D00611_0275_AHMM2JBCXX'
g_trimmed_fastqs_dir = '/Users/Birmingham/Repositories/ccbb_tickets/20160210_mali_crispr/data/interim/20160504_D00611_0275_AHMM2JBCXX'
g_full_5p_r1 = 'TATATATCTTGT... |
15,886 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Estimating Joint Tour Participation
This notebook illustrates how to re-estimate a single model component for ActivitySim. This process
includes running ActivitySim in estimation mode to r... | Python Code:
import os
import larch # !conda install larch -c conda-forge # for estimation
import pandas as pd
Explanation: Estimating Joint Tour Participation
This notebook illustrates how to re-estimate a single model component for ActivitySim. This process
includes running ActivitySim in estimation mode to read h... |
15,887 | Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
I have a set of objects and their positions over time. I would like to get the distance between each car and their nearest neighbour, and calculate an average of this for each time ... | Problem:
import pandas as pd
time = [0, 0, 0, 1, 1, 2, 2]
x = [216, 218, 217, 280, 290, 130, 132]
y = [13, 12, 12, 110, 109, 3, 56]
car = [1, 2, 3, 1, 3, 4, 5]
df = pd.DataFrame({'time': time, 'x': x, 'y': y, 'car': car})
import numpy as np
def g(df):
time = df.time.tolist()
car = df.car.tolist()
nearest_ne... |
15,888 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Alright in this section we're going to continue with the running data set but we're going to dive a bit deeper into ways of analyzing the data including filtering, dropping rows, doing some ... | Python Code:
pd.read_csv?
list(range(1,7))
df = pd.read_csv('../data/date_fixed_running_data_with_time.csv', parse_dates=['Date'], usecols=list(range(0,6)))
df.dtypes
df.sort(inplace=True)
df.head()
Explanation: Alright in this section we're going to continue with the running data set but we're going to dive a bit deep... |
15,889 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
... | Python Code:
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from itertools import cycle
from sklearn import svm, datasets
from sklearn.metrics import roc_curve, auc
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import label_binarize
from sklearn.multiclass import One... |
15,890 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
HMM with Poisson observations for detecting changepoints in the rate of a signal
This notebook is based on the
Multiple Changepoint Detection and Bayesian Model Selection Notebook of TensorF... | Python Code:
from IPython.utils import io
with io.capture_output() as captured:
!pip install distrax
!pip install flax
import logging
logging.getLogger("absl").setLevel(logging.CRITICAL)
import numpy as np
import jax
from jax.random import split, PRNGKey
import jax.numpy as jnp
from jax import jit, lax, vmap
fr... |
15,891 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Compute source power using DICS beamfomer
Compute a Dynamic Imaging of Coherent Sources (DICS) filter from single trial
activity to estimate source power for two frequencies of interest.
The... | Python Code:
# Author: Roman Goj <roman.goj@gmail.com>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne.datasets import sample
from mne.time_frequency import csd_epochs
from mne.beamformer import dics_source_power
print(__doc__)
data_path = sample.data_path()
raw_fname... |
15,892 | 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', 'cmcc', 'cmcc-esm2-hr5', 'aerosol')
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CMCC
Source ID: CMCC-ESM2-HR5
Topic: Aerosol
Sub-Topics: Transport, E... |
15,893 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Selecting only closed loans
Step1: Investigating closed loans
features summary
Total loans
Step2: TODO
Step3: Investigate whether the two weird 'does not meet' categories should stay in t... | Python Code:
# 887,379 loans in total
loans = pd.read_csv('../data/loan.csv')
loans['grade'] = loans['grade'].astype('category', ordered=True)
loans['last_pymnt_d'] = pd.to_datetime(loans['last_pymnt_d'])#.dt.strftime("%Y-%m-%d")
loans.shape
loans['loan_status'].unique()
# most loans are current
sns.countplot(loans['lo... |
15,894 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<h3> Exploring the function of mask how we can put a list inside numpy array </h3>
Step1: <h3> Exploring 2d array </h3>
Step2: <h3> Finding the L2 or euclidean distance based on test and t... | Python Code:
mask = range(5)
a = np.array(a)
a[mask]
Explanation: <h3> Exploring the function of mask how we can put a list inside numpy array </h3>
End of explanation
b = np.array([[1,2,3,4],[5,6,7,8]])
b
b[1,2]
b[1]
b[1,:]
b[:]
b[:,1]
b = np.array([1,2,3,4])
np.dot(b,b)
c = np.array([[1,2,3,4],[5,6,7,8]])
c
a = np.ar... |
15,895 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
2A.ml - Machine Learning et données cryptées
Comment faire du machine learning avec des données cryptées ? Ce notebook propose d'en montrer un principe exposé dans CryptoNets
Step1: Princip... | Python Code:
%matplotlib inline
from jyquickhelper import add_notebook_menu
add_notebook_menu()
Explanation: 2A.ml - Machine Learning et données cryptées
Comment faire du machine learning avec des données cryptées ? Ce notebook propose d'en montrer un principe exposé dans CryptoNets: Applying Neural Networks to Encrypt... |
15,896 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Title
Step1: This is some text, here comes some latex
Step2: Apos?
Step3: Javascript plots
plotly
Step4: bokeh | Python Code:
a = 1
a
b = 'pew'
b
%matplotlib inline
import matplotlib.pyplot as plt
from pylab import *
x = linspace(0, 5, 10)
y = x ** 2
figure()
plot(x, y, 'r')
xlabel('x')
ylabel('y')
title('title')
show()
import numpy as np
num_points = 130
y = np.random.random(num_points)
plt.plot(y)
Explanation: Title: Notebook w... |
15,897 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<img src="http
Step1: Second, the instantiation of the class.
Step2: The following is an example list object containing datetime objects.
Step3: The call of the method get_forward_reates(... | Python Code:
from dx import *
me = market_environment(name='me', pricing_date=dt.datetime(2015, 1, 1))
me.add_constant('initial_value', 0.01)
me.add_constant('volatility', 0.1)
me.add_constant('kappa', 2.0)
me.add_constant('theta', 0.05)
me.add_constant('paths', 1000)
me.add_constant('frequency', 'M')
me.add_constant('... |
15,898 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Random Sampling
Copyright 2016 Allen Downey
License
Step1: Part One
Suppose we want to estimate the average weight of men and women in the U.S.
And we want to quantify the uncertainty of th... | Python Code:
%matplotlib inline
import numpy
import scipy.stats
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
# seed the random number generator so we all get the same results
numpy.random.seed(18)
Explanation: Random Sampling
Copyright 2016 Allen Downe... |
15,899 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Batch Normalization – Practice
Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a convolutional neural network with 20 convolutional l... | Python Code:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False)
Explanation: Batch Normalization – Practice
Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll crea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.