Unnamed: 0 int64 0 15.9k | cleaned_code stringlengths 67 124k ⌀ | cleaned_prompt stringlengths 168 30.3k ⌀ |
|---|---|---|
10,300 | <ASSISTANT_TASK:>
Python Code:
import NotebookImport
from Imports import *
matched_meth = pd.read_hdf(METH_STORE, 'matched_tn')
matched_meth = matched_meth.groupby(axis=1, level=[0,1]).first()
matched_meth.T.head(10).T.head()
matched_meth.shape[1] / 2
matched_rna = matched_tn
matched_mir = pd.read_hdf(MIRNA_STORE, 'm... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: matched_meth is our matched methylation data.
Step2: Read in matched Gene and miRNA expression data.
Step3: Run a simple screen for DX genes
S... |
10,301 | <ASSISTANT_TASK:>
Python Code:
import time
time.time()
## gets the time, still not very human readable
time.localtime()
## formats the time nicely
time.asctime(time.localtime())
## series of random numbers doesn't repeat
<END_TASK> | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 1. Describe the results.
Step2: But we digress. Back to random numbers...
|
10,302 | <ASSISTANT_TASK:>
Python Code:
from __future__ import division
%matplotlib inline
import numpy as np
import reducer.gui
import reducer.astro_gui as astro_gui
from reducer.image_browser import ImageBrowser
import msumastro
from reducer import __version__
print __version__
# To use the sample data set:
data_dir = reduce... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Enter name of directory that contains your data in the cell below, or...
Step2: Type any comments about this dataset here
Step3: Image Summary... |
10,303 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import shapely.geometry
import shapely.ops
import cartopy
import cartopy.io.shapereader as shpreader
point = shapely.geometry.Point(0.2, 1.0)
# Notice, the ipython '__repr__' (representation) displays the point as the ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 0D shapes
Step2: 1D shapes
Step3: 2D shapes, Polygons and Buffers
Step4: We can also create 2D objects by adding buffers to existing 0D and 1... |
10,304 | <ASSISTANT_TASK:>
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 writin... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Effective Tensorflow 2
Step2: Recommendations for idiomatic TensorFlow 2
Step3: Then prepare the data for training
Step4: To keep the example... |
10,305 | <ASSISTANT_TASK:>
Python Code:
# Import some libraries that will be necessary for working with data and displaying plots
# To visualize plots in the notebook
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import scipy.io # To read matlab files
import pylab
# For the stude... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: This notebook covers the problem of fitting parametric regression models with a minimum least-squares criterion. The material presented here is ... |
10,306 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import scipy as sp
%matplotlib inline
T = 600 #[s]
fs = 500 #[Hz]
f0 = 0.04 #[Hz]
f1 = 10 #[Hz]
f2 = 11 #[Hz]
t = np.linspace(0,T,fs*T)
signal = 10*(np.cos(2*np.pi*f0*t))**8*np.sin(2*np.pi*f1*t)... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Toy Example
Step2: The following is a spectrogram of the simulated signal that highlights the limitations of classical frequency analysis. The... |
10,307 | <ASSISTANT_TASK:>
Python Code:
from halomod import TracerHaloModel
import numpy as np
from matplotlib import pyplot as plt
hm = TracerHaloModel(hod_model="Constant", transfer_model='EH')
hm.central_occupation
plt.plot(np.log10(hm.m),hm.satellite_occupation)
from halomod.concentration import CMRelation
from hmf.halos.m... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Density Profile
Step2: One can see that indeed the density profile is now independant of halo mass
Step3: That means the parameter logA for th... |
10,308 | <ASSISTANT_TASK:>
Python Code:
particles = ["B+/-","D+/-","J/Psi"]
lifetimes = [1.64e-12,1.4e-12,7e-21]
c = 3e8 # m/s
v = c
for p,l in zip(particles,lifetimes):
distance = v*l
print "%-5s lifetime=%4.2e s distance traveled=%4.2e m" % (p,l,distance)
# Your code here
# Your code here
# Your code here
# Y... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: <h3>Particles</h3>
Step2: The scale of many modern physics detectors ranges from the order of centimeters to 10's of meters. Given that informa... |
10,309 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
total_tosses = 30
num_heads = 24
prob_head = 0.5
#0 is tail. 1 is heads. Generate one experiment
experiment = np.random.randint(0,2,total_tosses)
print("Data of the Experiment:", experiment)
#Find the number of heads
print("Heads in the Experiment:", experiment[experi... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Exercise
Step2: Exercise
|
10,310 | <ASSISTANT_TASK:>
Python Code:
# Import
from __future__ import division
%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams['figure.figsize'] = (20.0, 10.0)
inline_rc = dict(mpl.rcParams)
from classification_utilities import make_facies_log_plot
import pandas as pd
import numpy as n... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Load data
Step2: Data inspection
Step3: Feature imputation
Step4: Feature augmentation
Step5: Generate training, validation and test data sp... |
10,311 | <ASSISTANT_TASK:>
Python Code:
# Učitaj osnovne biblioteke...
import sklearn
import mlutils
import numpy as np
import matplotlib.pyplot as plt
%pylab inline
from collections import Counter
class VotingClassifierDIY(object):
SCHEME_COUNTING = "counting"
SCHEME_AVERAGING = "averaging"
def __init__(... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 1. Ansambli (glasovanje)
Step2: (b)
Step3: Q
Step4: Razred koji implementira stablo odluke jest tree.DecisionTreeClassifier. Prvo naučite sta... |
10,312 | <ASSISTANT_TASK:>
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 Cloud MLE
TFVERSION = "1.14" # TF version for CMLE to use
import os
os.environ["BUCK... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: Create ML datasets by sampling using BigQuery
Step3: There are only a limited number of years, months, days, and states in the dataset. Let's s... |
10,313 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
# pandas is a software library for data manipulation and analysis
# We commonly use shorter nicknames for certain packages. Pandas is often abbreviated to pd.
# hit shift + enter to run this cell or block of code
path = r'./chopstick-effectiveness.csv'
# Change the pat... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Let's do a basic statistical calculation on the data using code! Run the block of code below to calculate the average "Food Pinching Efficiency"... |
10,314 | <ASSISTANT_TASK:>
Python Code:
# loading libraries and reading the data
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# set seaborn theme if you prefer
sns.set(style="white")
# read data
market_df = pd.read_csv("./global_sales_data/market_fact.csv")
customer_df = pd.read_c... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Visualising Simple Time Series Data
Step2: Since the Order_Date variable is in the orders dataframe, let's merge it.
Step3: Since Order_Date i... |
10,315 | <ASSISTANT_TASK:>
Python Code:
import autofig
import numpy as np
import phoebe # PHOEBE 2.1.0
#autofig.inline()
times = np.linspace(0,1,21)
# create an "interesting" system in PHOEBE
b = phoebe.default_binary()
b.set_value('incl@orbit', 75)
b.set_value('q', 0.5)
b.set_value('requiv@secondary', 0.6)
# add datasets and c... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Now let's set the projection to '3d', set the range for the viewing angles and disable pad_aspect (as it doesn't play nicely with animations).
|
10,316 | <ASSISTANT_TASK:>
Python Code:
import time
import numpy as np
import tensorflow as tf
import utils
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import zipfile
dataset_folder_path = 'data'
dataset_filename = 'text8.zip'
dataset_name = 'Text8 Dataset'
class DLProgress(tq... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Load the text8 dataset, a file of cleaned up Wikipedia articles from Matt Mahoney. The next cell will download the data set to the data folder. ... |
10,317 | <ASSISTANT_TASK:>
Python Code:
from __future__ import print_function
import warnings
from sklearn.exceptions import ConvergenceWarning
warnings.filterwarnings("ignore", category=ConvergenceWarning)
warnings.filterwarnings("ignore", category=FutureWarning)
import itertools
import os
import time
import six
import numpy a... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 0.1 Verta import and setup
Step2: 1. Model training
Step3: 1.2 Define hyperparams
Step4: 1.3 Train/test code
Step5: 2. Register Model for de... |
10,318 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import numpy.random as nr
import numpy as np
from matplotlib import pyplot as plt
the_mean=75
the_sigma=20.
numpoints=1000
outRandom=nr.normal(the_mean,the_sigma,[numpoints,])
outRandom=outRandom[outRandom <= 100.]
outRandom=outRandom[outRandom >= 0.]
#
# histogram the... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Remove all grades below 0 or above 100
Step2: Note that UBC has grade boundaries that narrow for higher marks. Just counting the number in eac... |
10,319 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
import numpy as np
import pylab as plt
# Set the global default size of matplotlib figures
plt.rc('figure', figsize=(10, 5))
# Size of matplotlib figures that contain subplots
fizsize_with_subplots = (10, 10)
# Size of matplotlib histogram bins
bin_size = 10
df_train ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Explore the Data
Step2: View the data types of each column
Step3: Type 'object' is a string for pandas, which poses problems with machine lear... |
10,320 | <ASSISTANT_TASK:>
Python Code:
prices = {
'ACME': 45.23,
'AAPL': 612.78,
'IBM': 205.55,
'HPQ': 37.20,
'FB': 10.75
}
# Make a dictionary of all prices over 200
p1 = {key: value for key, value in prices.items() if value > 200}
p1
# Make a dictionary of tech stocks
tech_names = {'AAPL', 'IBM', 'HPQ', '... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 讨论
Step2: 但是,字典推导方式表意更清晰,并且实际上也会运行的更快些 (在这个例子中,实际测试几乎比 dcit() 函数方式快整整一倍)。
|
10,321 | <ASSISTANT_TASK:>
Python Code:
#Set up the model and vector that we are using in the comparison
from gensim.similarities.index import AnnoyIndexer
from gensim.models.word2vec import Word2Vec
model = Word2Vec.load("/tmp/leemodel")
model.init_sims()
vector = model.syn0norm[0]
annoy_index = AnnoyIndexer(model, 500)
%%time... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: A similarity query using Annoy is significantly faster than using the traditional brute force method
Step2: Making a Similarity Query
Step3: C... |
10,322 | <ASSISTANT_TASK:>
Python Code:
import logging
from conf import LisaLogging
LisaLogging.setup()
# Generate plots inline
%matplotlib inline
import json
import os
# Support to access the remote target
import devlib
from env import TestEnv
from executor import Executor
# RTApp configurator for generation of PERIODIC tasks... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Import required modules
Step2: Target Configuration
Step3: Workload Execution and Functions Profiling Data Collection
Step4: Parse Trace and ... |
10,323 | <ASSISTANT_TASK:>
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 writin... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Text classification with an RNN
Step2: Import matplotlib and create a helper function to plot graphs
Step3: Setup input pipeline
Step4: Initi... |
10,324 | <ASSISTANT_TASK:>
Python Code:
class EpsGreedy:
def __init__(self, n_arms, eps=0):
self.eps = eps
self.n_arms = n_arms
self.payoffs = np.zeros(n_arms)
self.n_plays = np.zeros(n_arms)
def play(self):
# Note that the theory tells us to pick epsilon as O(1/t), not const... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: UCB1
|
10,325 | <ASSISTANT_TASK:>
Python Code:
#imports
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
import pylab as pl
import numpy as np
%matplotlib inline
#Read in data from source
df_raw = pd.read_csv("../assets/admissions.csv")
print df_raw.h... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step 1
Step1: Step 2
Step2: Questions
Step3: Answer
Step4: Question 3. Why would GRE have a larger STD than GPA?
Step5: Question 5. Confirm that yo... |
10,326 | <ASSISTANT_TASK:>
Python Code:
## Example from PEP 0255
def fib():
a, b = 0, 1
while 1:
yield b
a, b = b, a + b
gen1 = fib()
# prints the first 10 fibonnaci numbers
for i in range(10):
print(next(gen1), end=', ')
print("\nPassed!")
def nsquared(n):
while True:
yield n ** 2
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: This is a generator that yields the infinite Fibonnaci sequence. With every call to fib after the first call, the state of the generator gets up... |
10,327 | <ASSISTANT_TASK:>
Python Code:
%reload_ext autoreload
%autoreload 2
%matplotlib inline
from fastai.conv_learner import *
import torch
torch.cuda.is_available()
PATH = '../data/planet/'
ls {PATH}
!ls {PATH}train-jpg/ | wc -l
!ls {PATH}test-jpg/ | wc -l
from fastai.plots import *
def get_1st(path): return glob(f'{path}/... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Multi-label versus single-label classification
Step2: In single-label classification each sample belongs to one class. In the previous example,... |
10,328 | <ASSISTANT_TASK:>
Python Code:
DON'T MODIFY ANYTHING IN THIS CELL
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
view_sentence_range = (0, 10)
DON'T MODIFY ANYTHING IN THIS CELL
import num... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: TV Script Generation
Step3: Explore the Data
Step6: Implement Preprocessing Functions
Step9: Tokenize Punctuation
Step11: Preprocess all the... |
10,329 | <ASSISTANT_TASK:>
Python Code:
from sympy import *
init_printing(use_latex=True)
from IPython.display import Latex
%matplotlib inline
x, w2 = symbols('x omega^2')
L, m, EJ = symbols('L m EJ', positive = True)
A, B, C, D, ld, LD = symbols('A B C D lambda Lambda')
f, φ = symbols('f phi')
mass_coeff = 8
stiff_coeff = 24... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Symbols
Step2: Supported mass and stiffness of support
Step3: General solution and its derivatives
Step4: Left boundary conditions
Step5: Fi... |
10,330 | <ASSISTANT_TASK:>
Python Code:
Instructions:
+ Print out the second element from the areas list, so 11.25.
+ Subset and print out the last element of areas, being 9.50.
- Using a negative index makes sense here!
+ Select the number representing the area of the living room
a... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Subsetting Lists
Step3: 2. Subset and calculate
Step5: 3. Slicing and dicing
Step7: 4. Slicing and dicing (2)
Step9: **5. Subsetting lists o... |
10,331 | <ASSISTANT_TASK:>
Python Code:
# import libraries
import torch
import numpy as np
from torchvision import datasets
import torchvision.transforms as transforms
from torch.utils.data.sampler import SubsetRandomSampler
# number of subprocesses to use for data loading
num_workers = 0
# how many samples per batch to load
b... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Load and Visualize the Data
Step2: Visualize a Batch of Training Data
Step3: View an Image in More Detail
Step4: Define the Network Architect... |
10,332 | <ASSISTANT_TASK:>
Python Code:
import sys
try:
import docplex.mp
except:
raise Exception('Please install docplex. See https://pypi.org/project/docplex/')
try:
import cplex
except:
raise Exception('Please install CPLEX. See https://pypi.org/project/cplex/')
import numpy as np
gas_names = ["super", "reg... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: If CPLEX is not installed, you can install CPLEX Community edition.
Step2: Step 2
Step3: Step 3
Step5: Use basic HTML and a stylesheet to for... |
10,333 | <ASSISTANT_TASK:>
Python Code:
# Third party python libraries
import numpy
# Try and import from "The Virtual Brain"
from tvb.simulator.lab import *
from tvb.datatypes.time_series import TimeSeriesRegion
import tvb.analyzers.fmri_balloon as bold
from tvb.simulator.plot import timeseries_interactive as timeseries_intera... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Perform the simulation
Step2: Plot pretty pictures of what we just did
|
10,334 | <ASSISTANT_TASK:>
Python Code:
!pip install -I "phoebe>=2.2,<2.3"
%matplotlib inline
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger()
b = phoebe.default_binary()
print(b.get_parameter(qualifier='ecc'))
print(b.get_parameter(qualifier='ecosw', conte... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: As always, let's do imports and initialize a logger and a new Bundle. See Building a System for more details.
Step2: Relevant Parameters
Step3... |
10,335 | <ASSISTANT_TASK:>
Python Code:
while = 1
for i in range(1,10) print('Hello world')
for i in range(1,10):
x = 1 + i
print(x)
print("Some python issues are easier to find than others ')
print("Missing brackets can be difficult" , range(1,10)
print("to find. probably not these ones however.")
x = int(input("Ple... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Missing colon at the end of for, while, if, def statements.
Step2: Incorrect indentation. Don't mix spaces and tabs!
Step3: Mismatched quotati... |
10,336 | <ASSISTANT_TASK:>
Python Code:
initial = [1, 0, 0, 0, 1, 0, 0, 0]
final = [0, 0, 0, 0, 1, 0, 1, 0]
# Importing necessary extensions
import numpy as np
import itertools
import functools
import operator
# The use of type annotations requires Python 3.6 or newer
from typing import List
# looking for the positions/levels... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: To compute if an optical transition between two states is possible or not, we first get some libraries to make this easier.
Step2: The question... |
10,337 | <ASSISTANT_TASK:>
Python Code:
import base64
token = base64.b64decode("Njk4ZGVjMWE5Y2YyNDQ5ZmNhY2FkOWU4NDdjMDk5NWU1NTZhMDk5Yw====").decode("utf-8")
! rm -rf tp-datos-2c2020 datos
! git clone https://{token}@github.com/AlexDaciuk/tp-datos-2c2020.git
! mv tp-datos-2c2020 datos
from datos.preproc import preprocessing
from... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Random Forest Classifier
Step2: Cantidad de árboles entrenados
Step3: Veamos el primero de ellos
Step4: Y sus métricas
|
10,338 | <ASSISTANT_TASK:>
Python Code:
import os
from ascat.cgls import SWI_TS
import matplotlib.pyplot as plt
%matplotlib inline
ls ../tests/ascat_test_data/cglops/swi_ts
data_path = os.path.join('..', 'tests', 'ascat_test_data', 'cglops', 'swi_ts')
rd = SWI_TS(data_path)
data = rd.read_ts(3002621)
print(data)
fig, ax = plt... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: By default we should have the grid file from the SWI-STATIC collection and the unzipped SWI-TS products in one folder like so
Step2: Since the ... |
10,339 | <ASSISTANT_TASK:>
Python Code:
initialize()
print(train())
print(train())
initialize()
for layer in [a,b,c]:
layer.weight.data = torch.ones_like(layer.weight)
print(c.weight)
train(), print(c.weight)
train(), print(c.weight)
train(), print(c.weight)
b.weight #there's a small amount of symmetry breaking, but the f... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Random biases, No randomness in weights
Step2: fan-ins are almost identical across neurons, elements within one neuron's fan-in are different
S... |
10,340 | <ASSISTANT_TASK:>
Python Code:
import itertools
import pandas as pd
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.model_selection import GridSearchCV, StratifiedKFold, cross_val_predict
from sklearn.feature_extraction import stop_words
from sklearn.metrics import classification_report
data_file ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Next, let's load the data. Write the path to your sms.csv file in the cell below
Step2: Execute the cell below to load the CSV data into a pand... |
10,341 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from IPython.core.display import display, HTML
%matplotlib inline
import swat
s = swat.CAS('cloud.example.com', 5570)
ulresult = s.upload('http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic3.csv')
titanic... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Get the Data
Step2: Add a Computed Column
Step3: Group By Analysis
Step4: Sample the Data
Step5: Check that Sampling is Even
Step6: Train a... |
10,342 | <ASSISTANT_TASK:>
Python Code:
import xgboost
import shap
# load JS visualization code to notebook
shap.initjs()
# train XGBoost model
X,y = shap.datasets.boston()
bst = xgboost.train({"learning_rate": 0.01}, xgboost.DMatrix(X, label=y), 100)
# explain the model's predictions using SHAP values
explainer = shap.TreeExp... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: The plot color maps are named based on the color maps on matplotlib.
Step2: The same can be applied to lists of explanations
Step3: The differ... |
10,343 | <ASSISTANT_TASK:>
Python Code:
import json
import numpy as np
import pandas as pd
from jupyter_scisheets_widget import scisheets_widget
import pandas_datareader as pdr
ibm_data = pdr.get_data_yahoo('IBM')
income_data = pd.read_csv('income_data.csv', sep=';')
income_data
income_data['test_col'] = income_data['2006']
i... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Load data into the notebook
Step2: BUG currently seems to be coming from handonstable rendering
Step3: Testing different ways to convert df to... |
10,344 | <ASSISTANT_TASK:>
Python Code:
from pomegranate import *
%pylab inline
import numpy as np
data = np.concatenate( (np.random.randn(250, 1) * 2.75 + 1.25, np.random.randn(500, 1) * 1.2 + 7.85) )
np.random.shuffle(data)
plt.hist( data, edgecolor='c', color='c', bins=20 )
d = GeneralMixtureModel( [NormalDistribution(2.5, ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: We can create our initial estimate of what this distribution is a General Mixture Model. This is a model which is comprised of multiple distribu... |
10,345 | <ASSISTANT_TASK:>
Python Code:
input_form =
<table>
<td style="border-style: none;">
<div style="border: solid 2px #666; width: 143px; height: 144px;">
<canvas width="140" height="140"></canvas>
</div></td>
<td style="border-style: none;">
<button onclick="clear_value()">Clear</button>
</td>
</table>
javascript = '''
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: This creates a canvas where you can draw a handwritten digit.
Step2: Now you can send a request to make a prediction.
Step3: You can also draw... |
10,346 | <ASSISTANT_TASK:>
Python Code:
#!pip install -I "phoebe>=2.3,<2.4"
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger()
b = phoebe.default_binary()
b.set_value('sma@binary', 20)
b.set_value('q', 0.8)
b.set_value('ecc', 0.8)
b.set_value('per0', 45)
b.g... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: As always, let's do imports and initialize a logger and a new Bundle.
Step2: And let's make our system a little more interesting so that we can... |
10,347 | <ASSISTANT_TASK:>
Python Code:
import sys
import os
import numpy as np
try:
import pandas as pd
except:
pass
import flopy
m = flopy.modflow.Modflow('mnw2example', model_ws='temp')
dis = flopy.modflow.ModflowDis(nrow=5, ncol=5, nlay=3, nper=3, top=10, botm=0, model=m)
node_data = pd.DataFrame([[1, 1, 9.5, 7.1,... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Make an MNW2 package from scratch
Step2: MNW2 information by node
Step3: convert the DataFrame to a rec array for compatibility with flopy
Ste... |
10,348 | <ASSISTANT_TASK:>
Python Code:
import gzip
import cPickle as pickle
with gzip.open("../data/train.pklz", "rb") as train_file:
train_set = pickle.load(train_file)
with gzip.open("../data/test.pklz", "rb") as test_file:
test_set = pickle.load(test_file)
with gzip.open("../data/questions.pklz", "rb") as questions_... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Let's take a look the loaded data set.
Step2: Make training set
Step3: It means that user 0 tried to solve question number 1 which has 77 toke... |
10,349 | <ASSISTANT_TASK:>
Python Code:
# Set `PATH` to include the directory containing TFX CLI and skaffold.
PATH=%env PATH
%env PATH=/home/jupyter/.local/bin:{PATH}
!grep 'BASE_IMAGE =' -A 5 pipeline/covertype_training_pipeline.py
%%writefile ./pipeline/covertype_training_pipeline.py
# Copyright 2019 Google LLC
#
# License... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Understanding the pipeline design
Step7: The pipeline uses a mix of custom and pre-build components.
Step8: The custom components execute in a... |
10,350 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
def print_sum(a, b):
print(a+b)
interact(print_sum, a=(-10,10,.1), b=(-8, 8, 2))
assert True # leave this for ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Interact basics
Step2: Use the interact function to interact with the print_sum function.
Step3: Write a function named print_string that prin... |
10,351 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import scipy.linalg as la
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')
A = np.array([[1,2],[3,4]])
A
b = np.array([3,17])
b
x = la.solve(A, b)
x
np.allclose(A @ x, b)
A1 = np.random.random((1000,1000))
b1 = np.random.random(1000)
%timeit ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Resources
Step2: Using solve is faster and more stable numerically than using matrix inversion
Step3: Under the hood (Optional)
Step4: Basic ... |
10,352 | <ASSISTANT_TASK:>
Python Code:
from sympy import isprime
[isprime(i) for i in [2, 3, 5, 7, 10, 11, 13, 17, 2017]]
from numpy.random import randint
%timeit sum([isprime(i) for i in randint(1e8, 1e9-1, 10**4)])
from datetime import datetime
today = datetime.today()
YEAR = today.year
print("On va travailler avec l'anné... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Elle marche très bien, et est très rapide !
Step2: Pour des nombres de 8 chiffres (c'est tout petit), elle est vraiment rapide
Step3: $\impli... |
10,353 | <ASSISTANT_TASK:>
Python Code:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
# Some of these are hard to distinguish.
# Check https://quickdraw.withgoogle.com/data for examples
zoo = ['frog', 'horse', 'lion', 'monk... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: The data is fun to look at. Compared to MNIST the classes seem much harder to distinguish
Step2: Our labels are 0,1,2,..,10 right now. We conve... |
10,354 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import time
from scipy import stats
from scipy.optimize import minimize
stud_learning = pd.read_csv('student_learning_final.csv')
stud_learning.drop(['Unnamed: 0'], axis=1, inplace=True)
cluster_inde... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step 3 (comparison of learning rates between clusters)
Step1: Determine what clusters more successful in learning in terms of fraction of correct attem... |
10,355 | <ASSISTANT_TASK:>
Python Code:
agencia_for_cliente_producto = train_dataset[['Cliente_ID','Producto_ID'
,'Agencia_ID']].groupby(['Cliente_ID',
'Producto_ID']).agg(lambda x:x.value_counts().index[0]).res... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: make pivot table of test
Step2: groupby use Agencia_ID, Ruta_SAK, Cliente_ID, Producto_ID
Step3: if predict week 8, use data from 3,4,5,6,7
St... |
10,356 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from ipywidgets import interact, fixed
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
barZ = np.array([[1],[3]])
QZ = np.array([[3,1],[1,1]])
a = barZ[0]
b = QZ[0,0]
xx = np.linspace(-6, 10, 100)
R = QZ[0,0]-QZ[0,1]*QZ[0,1]/QZ[1,1]
def pl... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Système linéaire gaussien en tems discret
Step2: Un peu de vectorisation
Step3: Filtrage linéaire gaussien
|
10,357 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
A=np.asarray([[1,1,1], [1,1,2], [1,1,3], [1,1,4]])
B=np.asarray([[0,0,0], [1,0,2], [1,0,3], [1,0,4], [1,1,0], [1,1,1], [1,1,4]])
dims = np.maximum(B.max(0),A.max(0))+1
output = A[~np.in1d(np.ravel_multi_index(A.T,dims),np.ravel_multi_index(B.T,dims))]
<END_TASK> | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
|
10,358 | <ASSISTANT_TASK:>
Python Code:
from jyquickhelper import add_notebook_menu
add_notebook_menu()
import urllib.request as ulib
def get_html(address, source="https://fr.wikipedia.org/wiki/"):
with ulib.urlopen(source+address) as u:
return u.read()
get_html("http://www.xavierdupre.fr", source="")[:100]
d... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Solution de Félix Revert.
Step2: Exercice 2
|
10,359 | <ASSISTANT_TASK:>
Python Code:
import random
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, pi, erf
import scipy.stats as ss
d = np.random.rand(10)
print (d)
print (ss.rankdata(d))
import pandas as pd
data = pd.read_csv('grades.csv')
#get some info:
data.info()
data /= data.iloc[0,:]
data ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Detour
Step2: Nonparametric Methods for Comparing Sets of Measurements
Step3: I'm going to standardize the homework so that they are all out o... |
10,360 | <ASSISTANT_TASK:>
Python Code:
from bs4 import BeautifulSoup
from urllib.request import urlopen
html = urlopen("http://static.decontextualize.com/cats.html").read()
document = BeautifulSoup(html, "html.parser")
cafe_list = list()
cafe_table = document.find('table', {'class': 'cafe-list'})
tbody = cafe_table.find('tbod... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Let's tackle the list of cafes first. In the cell below, write some code that creates a list of dictionaries with information about each cafe, a... |
10,361 | <ASSISTANT_TASK:>
Python Code:
lambda x,y : x%y
length_func = lambda x: len(x)
length_func("hello, there!")
# Even or Odd lambda
even_odd = lambda x: x % 2 == 0
even_odd = lambda x: True if x % 2 == 0 else False
even_odd(9)
# script that "converts" a tuple to a list
some_tup = ("[", 3, 4, "hello", "]")
x = lambda tu... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: As seen, when we assign a lambda expression to a label we can use it. Note that at default lambda expressions return the expected type of whatev... |
10,362 | <ASSISTANT_TASK:>
Python Code:
a = Table()
a.meta['dt'] = 0.0001 # time step, in seconds
a.meta['duration'] = 200 # length of time, in seconds
a.meta['omega'] = 2*np.pi # angular frequency, in radians
a.meta['phi'] = 0.0 # offset angle, in radians
freq = fftpack.fftfreq(len(a), d=a.meta['dt'])
nyq_ind = int(len(a)/... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 1a. Compute the time steps and a cosine harmonic with the above-defined properties.
Step2: 1e. Plot them!
Step3: Plot it!
Step4: 2c.ii. Somet... |
10,363 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import netCDF4
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import colors
from mpl_toolkits.basemap import Basemap
datadir = './datafiles/'
datafile = 'GL_TS_DC_2300691.nc'
with netCDF4.Dataset(datadir + datafile) as nc:
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Data reading
Step2: We extract only the spatial coordinates
Step3: Basic plot
Step4: We will also indicate Start and End labels at the corres... |
10,364 | <ASSISTANT_TASK:>
Python Code:
%pylab inline
import scipy.linalg as la
def signal(t):
return 1-(t-2)**2 if (t<3 and t>1) else 0
num_samples = rows = cols = 2**12
time_list = linspace(0.0001,4,num_samples)
signal_list = [signal(time) for time in time_list]
plot(time_list,signal_list)
def DFT(x,inverse=False):
... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Generating the signal
Step2: Now we create the function that will perform the discrete fourier transform.
Step3: A look into the mathematical ... |
10,365 | <ASSISTANT_TASK:>
Python Code:
import google.datalab.bigquery as bq
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
from sklearn impo... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: SAM (System for Award Management) - exclusions
Step2: There are 8,659 firms on the SAM exclusion list
Step3: NPI and CAGE don't seem to be gre... |
10,366 | <ASSISTANT_TASK:>
Python Code:
from urllib.request import urlretrieve
from os.path import isfile
from tqdm import tqdm
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_size=None):
self.total = total_size
self.update((block_num - self.last_block) * block_size... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Overview
Step2: Load the Data
Step3: Preprocess the Data
Step4: Normalize the features
Step5: One-Hot Encode the labels
Step6: Keras Sequen... |
10,367 | <ASSISTANT_TASK:>
Python Code:
import random
from numba import jit
import numpy as np
# Monte Carlo simulation function. This is defined as
# a function so the numba library can be used to speed
# up execution. Otherwise, this would run much slower.
@jit
def MCHist(n_hist, a, b, fmax):
score = (b - a)*fmax
tot_... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Checking this answer with Wolfram Alpha, we get approximately the same result
Step2: From the above figure, we can see that the maximum is abou... |
10,368 | <ASSISTANT_TASK:>
Python Code:
from __future__ import division
from sympy import *
init_printing()
x, y = symbols('x y') #define x e y como variáveis simbólicas.
def f(x): return (x**3 - 3*x + 2)*exp(-x/4) - 1
f(x)
diff(f(x),x)
diff(f(x),x).subs(x,1)
#digite sua solução aqui!
x0 = -1/2
fl = diff(f(x),x).subs(x,-0.... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Para fixar as ideias, vamos continuar trabalhando com a função
Step2: Derivadas
Step3: Para avaliar a derivada em um ponto, por exemplo, para ... |
10,369 | <ASSISTANT_TASK:>
Python Code:
from formosa import maxent_motifs, uniform_motifs, motif_ic
%matplotlib inline
from matplotlib import pyplot as plt
import random
random.seed(1)
maxent_samples = maxent_motifs(N=20, L=10, desired_ic=10, num_motifs=100000)
maxent_ics = map(motif_ic, maxent_samples)
_ = plt.hist(maxent_... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: The first two are for sampling; the third is for measuring the motif IC in order to validate our results. Let's also set up plotting for our no... |
10,370 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ec-earth-consortium', 'ec-earth3-hr', 'seaice')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contri... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 2... |
10,371 | <ASSISTANT_TASK:>
Python Code:
from __future__ import division
import graphlab
products = graphlab.SFrame('amazon_baby_subset.gl/')
import json
with open('important_words.json', 'r') as f:
important_words = json.load(f)
important_words = [str(s) for s in important_words]
# Remote punctuation
def remove_punctuati... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Load and process review dataset
Step2: Just like we did previously, we will work with a hand-curated list of important words extracted from the... |
10,372 | <ASSISTANT_TASK:>
Python Code:
!pip install --pre deepchem
import deepchem
deepchem.__version__
import deepchem as dc
import tensorflow as tf
from deepchem.models.optimizers import ExponentialDecay
from tensorflow.keras.layers import Conv2D, Conv2DTranspose, Dense, Reshape
import matplotlib.pyplot as plot
import matpl... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: To begin, let's import all the libraries we'll need and load the dataset (which comes bundled with Tensorflow).
Step2: Let's view some of the i... |
10,373 | <ASSISTANT_TASK:>
Python Code:
print('Importing libraries...')
import numpy as np
import pandas as pd
from sklearn import cross_validation as cv
from sklearn.cross_validation import KFold
from sklearn.ensemble import RandomForestClassifier
print('Fetching the training and test datasets...')
train = pd.read_csv("data/tr... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Cleaning the data & preparing a submission file
Step2: Creating new features
Step3: Finding best values for n_estimators and max_depth
Step4: ... |
10,374 | <ASSISTANT_TASK:>
Python Code:
import os, sys
sys.path = [os.path.abspath("../../")] + sys.path
from deep_learning4e import *
from notebook4e import *
psource(gradient_descent)
pseudocode(adam_optimizer)
psource(adam_optimizer)
psource(BackPropagation)
<END_TASK> | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: There several key elements need to specify when using a gradient_descent optimizer
Step2: There are several attributes to specify when using Ad... |
10,375 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import CombineCCFs
import numpy as np
from astropy import units as u, constants
from HelperFunctions import Gauss, integral
import os
import lmfit
import emcee
import triangle
from scipy.interpola... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Get and shift the Cross-correlation functions to the primary star rest frame
Step2: Measure the companion RVs.
Step3: Fix the dates to line up... |
10,376 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
%pylab inline --no-import-all
pylab.rcParams['figure.figsize'] = (18, 10)
from ntfdl import Multi
from matplotlib.finance import candlestick_ohlc
from datetime import datetime, timedelta
# Instantiate multi with instrument FOE from Oslo exchange (OSS)
foe = Multi('FOE',... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Multi just calls dl.get_trades() and merges the data. Netfonds makes 20 days including today available, hence some days are not trading days (we... |
10,377 | <ASSISTANT_TASK:>
Python Code:
!pip install hyperas
# Basic compuational libaries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import seaborn as sns
%matplotlib inline
np.random.seed(2)
from sklearn.model_selection import train_test_split
from sklearn.metrics i... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 2. Tiền xử lý
Step2: Kiểm tra phân bố của nhãn
Step3: Thử nhìn qua một số mẫu trong tập huấn luyện. Chúng ta thấy rằng hầu hết các ảnh đều rõ ... |
10,378 | <ASSISTANT_TASK:>
Python Code:
%load_ext autoreload
%autoreload 2
%matplotlib inline
#%config InlineBackend.figure_format = 'svg'
#%config InlineBackend.figure_format = 'pdf'
import freqopttest.util as util
import freqopttest.data as data
import freqopttest.ex.exglobal as exglo
import freqopttest.kernel as kernel
impor... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: This notebook investigates the stability of the learned test location. We consider the case where P is a mixture of two uniform distributions on... |
10,379 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'ukesm1-0-ll', 'atmoschem')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name",... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 1... |
10,380 | <ASSISTANT_TASK:>
Python Code:
import arviz as az
import numpy as np
import emcee
az.style.use("arviz-darkgrid")
J = 8
y_obs = np.array([28.0, 8.0, -3.0, 7.0, -1.0, 1.0, 18.0, 12.0])
sigma = np.array([15.0, 10.0, 16.0, 11.0, 9.0, 11.0, 10.0, 18.0])
def log_prior_8school(theta):
mu, tau, eta = theta[0], theta[1], th... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Manually set variable names
Step2: ArviZ has stored the posterior variables with the provided names as expected, but it has also included other... |
10,381 | <ASSISTANT_TASK:>
Python Code:
5 / 2
from sympy import Rational
Rational(5,2)
from sympy import S
S?
type(S(5))
S(5)/2
S('13/2') + S(5)/7
from sympy import arg,re,im,I
a = 3 + 5*I
re(a)
im(a)
arg(a).n()
abs(a)
from sympy import symbols
x3,x4,x5,x6,x7 = symbols('x3:8')
x3 + x4+ 6 *x7
from sympy import *
init_printing... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 3.2 Nombres complexes
Step2: 4.2 Définir les variables symboliques x_1, x_2, ... x_n
Step3: Initialisation
Step4: Importer quelques variables... |
10,382 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import pickle as pkl
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')
def model_inputs(real_dim, z_dim):
inputs_real = tf.placeholde... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Model Inputs
Step2: Generator network
Step3: Discriminator
Step4: Hyperparameters
Step5: Build network
Step6: Discriminator and Generator L... |
10,383 | <ASSISTANT_TASK:>
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
def checkerboard(size):
Z = np.empty((size,size),dtype=float)
Z.fill(1.0)
Z[1::2,::2] = 0.0
Z[::2,1::2] = 0.0
ret... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Checkerboard
Step2: Use vizarray to visualize a checkerboard of size=20 with a block size of 10px.
Step3: Use vizarray to visualize a checkerb... |
10,384 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ipsl', 'sandbox-1', 'land')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "email... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Document Authors
Step2: Document Contributors
Step3: Document Publication
Step4: Document Table of Contents
Step5: 1.2. Model Name
Step6: 1... |
10,385 | <ASSISTANT_TASK:>
Python Code:
def backward_differencing(f, x_i, dx):
Backward differencing of f at x_i with grid spacing dx.
f_i = f(x_i)
f_i_minus_1 = f(x_i - dx)
return (f_i - f_i_minus_1) / dx
def forward_differencing(f, x_i, dx):
Forward differencing of f at x_i with grid sp... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step3: Numerical Methods
Step4: The errors here are significant. What matters is how fast the errors reduce as we change the grid spacing. Try changin... |
10,386 | <ASSISTANT_TASK:>
Python Code:
L = []
for n in range(12):
L.append(n ** 2)
L
L = [n ** 2 for n in range(12)]
L
L = [n ** 0.5 for n in [11, 22, 33]]
L
[(i, j) for i in range(2) for j in range(3)]
L = []
for i in range(2):
for j in range(3):
if i == 0:
L.append((i, j))
L
[val for val in ran... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Compare it with this
Step2: As with many Python statements, you can almost read-off the meaning of this statement in plain English
Step3: Cond... |
10,387 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import numpy as np
import math, random # 計算用、乱数の生成用ライブラリ
import matplotlib.pyplot as plt # 描画用ライブラリ
class Landmarks:
def __init__(self, array):
self.positions = array # array = [[1個めの星のx座標, 1個めの星のy座標], [2個めの星のx座標, 2個めの星のy座標]...]
def ... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: 移動モデル
Step2: 観測モデル
Step3: 尤度計算
|
10,388 | <ASSISTANT_TASK:>
Python Code:
# check firewall
!rm index.html*
!wget www.google.com
import uuid
from google.cloud import dialogflow
# session format: 'projects/*/locations/*/agent/environments/*/users/*/sessions/*'.
def get_session(project_id, session_id, env=None):
Using the same `session_id` between request... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step2: Call dialogflow with python api
Step3: examples of making session url
Step4: visit Mega Agent and print
Step5: visit media/Music Agent
Step6:... |
10,389 | <ASSISTANT_TASK:>
Python Code::
def possible(x,S,N):
minSum = (x * (x + 1))//2
maxSum = (x * ((2 * N) - x + 1))//2
if(S < minSum or S > maxSum):
return False
return True
def findPermutation(N ,L ,R ,S ):
x = R - L + 1
if (not possible( x , S , N)) :
print(" - 1")
return
else :
v = []
for i... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
|
10,390 | <ASSISTANT_TASK:>
Python Code:
import os
import sys
import time
sys.path.append(os.path.abspath(os.path.join(os.path.pardir, os.path.sep.join(['..', 'codes']), 'client')))
sys.path.append(os.path.abspath(os.path.join(os.path.pardir, os.path.sep.join(['..', 'codes']), 'node')))
sys.path.append(os.path.abspath(os.path.... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: List of neurons
Step2: Start client
Step3: Utility functions
Step4: Reset neurons
Step5: Probe neurons by blinking LEDs
Step6: Setup connec... |
10,391 | <ASSISTANT_TASK:>
Python Code:
import requests
import pickle
r = requests.get('http://drgmk.com/sdb/seds/masters/'
'sdb-v2-132436.10-513016.1/public/sdb-v2-132436.10-513016.1-mnest/phoenix_m+modbb_disk_r_.json')
d = r.json()
for k in d.keys():
print(k, type(d[k]))
s = requests.get('http://drgmk.c... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: json output
Step2: The information contained in the json is largely related to the observational data, e.g. photometry and models in the observ... |
10,392 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from __future__ import print_function, division
import numpy
import scipy.stats
import matplotlib.pyplot as pyplot
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
# seed the random number generator so we all get the same results
numpy.ra... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Part One
Step2: The following function evaluates the normal (Gaussian) probability density function (PDF) within 4 standard deviations of the m... |
10,393 | <ASSISTANT_TASK:>
Python Code:
lc = np.loadtxt('data/lc.V.data')
rv1 = np.loadtxt('data/rv1.data')
rv2 = np.loadtxt('data/rv2.data')
b = phoebe.default_binary()
b.add_dataset('lc', times = lc[:,0], fluxes=lc[:,1], sigmas=lc[:,2], passband='Johnson:V')
b.add_dataset('rv', passband='Johnson:V')
b['times@rv@primary'], b['... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: We will set the pblum mode to dataset-scaled for estimators and optimizers, to avoid having to add pblum to the fitted parameters or adjusting i... |
10,394 | <ASSISTANT_TASK:>
Python Code:
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
!pip install tensorflow==2.1 --user
from google.cloud import bigquery
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import shutil
%%bigquery
SELECT
FORMAT_TIMESTAMP("%... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Please ignore any compatibility warnings and errors
Step2: <h3> Extract sample data from BigQuery </h3>
Step3: Let's increase the number of re... |
10,395 | <ASSISTANT_TASK:>
Python Code:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
#Loads important files for this analysis
filename = 'baseballdatabank-2017.1\core\Teams.csv'
teams_df = pd.read_csv(filename)
filename = 'baseballdatabank-2017.1\core\Salaries.csv'
salaries_df = p... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Introduction
Step2: At first glance
Step5: 1. On a yearly basis, does Baseball players who attended to college have greater income compared to... |
10,396 | <ASSISTANT_TASK:>
Python Code:
import graphviz as gv
def heapToDot(A):
n = len(A)
dot = gv.Digraph(node_attr={'shape': 'record'})
for k, (p, o) in enumerate(A):
if str(p) != str(o):
dot.node(str(k), label='{' + str(p) + '|' + str(o) + '|' + str(o.mIndex) + '|' + str(k) + '}', style='r... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: The function toDot takes four arguments
Step2: Priority Queues implemented as Heaps
Step3: The function ascend takes two arguments
Step4: The... |
10,397 | <ASSISTANT_TASK:>
Python Code:
# Use a question mark after a command to get more info about it
a = [1, 2, 3]
a.extend?
# Use double question marks to get the source code if available
def myfunc(x):
Fancy function
return x + 2
myfunc?
myfunc??
# Magic commands start with a % sign
%timeit print "foo"
# You can... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: IPython/Jupyter
Step2: Magic Commands
Step3: Executing shell commands
|
10,398 | <ASSISTANT_TASK:>
Python Code:
import bigbang.mailman as mailman
import bigbang.graph as graph
import bigbang.process as process
from bigbang.parse import get_date
#from bigbang.functions import *
from bigbang.archive import Archive
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import numpy as np... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: Also, let's import a number of other dependencies we'll use later.
Step2: Now let's load the data for analysis. Load the Archive, the get the c... |
10,399 | <ASSISTANT_TASK:>
Python Code:
import time
def timer():
start = time.time()
def f(report=False):
elapsed = time.time() - start
if report:
print ("time elapsed %5.3f" % elapsed)
return elapsed
return f
limit = 250
mytimer = timer()
can_reach = set()
numbers = set(range(... | <SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
Step1: We are only looking for combinations with $i<limit$
Step2: Procedural Style - square
Step3: Procedural Style - triangle
Step4: Functional Sty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.