Unnamed: 0 int64 0 15.9k | cleaned_code stringlengths 67 124k ⌀ | cleaned_prompt stringlengths 168 30.3k ⌀ |
|---|---|---|
10,700 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from quantopian.pipeline import Pipeline
from quantopian.pipeline.data import Fundamentals
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.factors 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: First we pull the returns of every asset in this universe across our desired time period.
Step3: Factor Returns and Exposures
Step4: Here we r... |
10,701 | <ASSISTANT_TASK:>
Python Code:
import mne
mne.set_log_level('WARNING')
mne.set_log_level('INFO')
mne.set_config('MNE_LOGGING_LEVEL', 'WARNING', set_env=True)
mne.get_config_path()
from mne.datasets import sample # noqa
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw... | <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 you'd like to turn information status messages off
Step2: But it's generally a good idea to leave them on
Step3: You can set the default le... |
10,702 | <ASSISTANT_TASK:>
Python Code:
import torch
import torch.nn as nn
import torch.functional as F
import pyro
import pyro.distributions as dist
import pyro.infer
import pyro.optim
import os
smoke_test = ('CI' in os.environ)
n_steps = 2 if smoke_test else 2000
def model(prior_mean, observations={"x1": 0, "x2": 0}):
x ... | <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: Specify the model
Step2: And the guide
Step3: Now create a CSIS instance
Step4: Now we 'compile' the instance to perform inference on this mo... |
10,703 | <ASSISTANT_TASK:>
Python Code:
from multiprocessing import Pool
from multiprocessing.dummy import Pool as ThreadPool
# Create a list of some data
data = range(29999)
# Create a function that takes a data point
def some_function(datum):
# and returns the datum raised to the power of itself
return datum**datum... | <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: Create Some Data
Step2: Create An Operation To Execute On The Data
Step3: Traditional Approach
Step4: Parallelism Approach
|
10,704 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'bcc', 'sandbox-1', 'ocean')
# 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,705 | <ASSISTANT_TASK:>
Python Code:
import os
import sys
import urllib2
import collections
import matplotlib.pyplot as plt
import math
from time import time, sleep
%pylab inline
spark_home = os.environ.get('SPARK_HOME', None)
if not spark_home:
raise ValueError("Please set SPARK_HOME environment variable!")
# Add 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: Prepare the pySpark Environment
Step2: Initialize Spark Context
Step3: Load and Analyse Data
Step4: Ratings Histogram
Step5: Most popular mo... |
10,706 | <ASSISTANT_TASK:>
Python Code:
# Append location of ipt module base directory to system path
# NOTE: only required if permanent install not made (see comments above)
import sys
sys.path.append('/Users/bgraham/Dropbox/Sites/software/ipt/')
# Load ipt module
import ipt as ipt
import warnings
def fxn():
warnings.warn... | <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: Hide Runtime warning messages to clean up output.
Step2: Now load additional libraries that will be used below.
Step3: Introducing ipt.att()
S... |
10,707 | <ASSISTANT_TASK:>
Python Code:
!pip install pygithub
!pip install geopy
!pip install ipywidgets
from github import Github
#this is my private login credentials, stored in ghlogin.py
import ghlogin
g = Github(login_or_token=ghlogin.gh_user, password=ghlogin.gh_passwd)
def vdir(obj):
return [x for x in dir(obj) if 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: With this Github object, you can retreive all kinds of Github objects, which you can then futher explore.
Step2: Users
Step3: Repositories
Ste... |
10,708 | <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,709 | <ASSISTANT_TASK:>
Python Code:
# 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, sof... | <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 to TensorFlow
Step2: This cell runs a magic that tells Colab to use TensorFlow 2 instead of TensorFlow 1 by default. This magic ne... |
10,710 | <ASSISTANT_TASK:>
Python Code:
# math
import numpy as np
from scipy.misc import comb
from scipy.stats import binom, norm
from itertools import accumulate
from math import sqrt, ceil, log
# python tools
from collections import Counter
from itertools import zip_longest
from multiprocessing import Process, Pool, Queue
fro... | <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: Getting a feel for it
Step2: How likely is it that we get exactly X% of $tau_1$?
Step3: How likely is it that we get $t_1$ samples, with $t_1$... |
10,711 | <ASSISTANT_TASK:>
Python Code:
%%bigquery
SELECT name, SUM(number) as count
FROM `bigquery-public-data.usa_names.usa_1910_current`
GROUP BY name
ORDER BY count DESC
LIMIT 10
%%bigquery --verbose
SELECT name, SUM(number) as count
FROM `bigquery-public-data.usa_names.usa_1910_current`
GROUP BY name
ORDER BY count DESC
L... | <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: Display verbose output
Step2: Explicitly specify a project
Step3: Assign the query results to a variable
Step4: Run a parameterized query
|
10,712 | <ASSISTANT_TASK:>
Python Code:
# Copyright 2021 Google LLC. All Rights Reserved.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | <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: DDSP Processor Demo
Step2: Example
Step3: get_controls()
Step4: Consider the plots above as outputs of a neural network. These outputs violat... |
10,713 | <ASSISTANT_TASK:>
Python Code:
from sabesPy import getData
import pandas as pd
df = pd.DataFrame([getData('2014-03-14'), getData('2015-03-14')])
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns ## só pra deixar o matplotlib com o estilo bonitão do seaborn ;)
sns.set_context("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: OK. Tudo certo. Bate com os gráficos mostrados pelo G1, apenas está sendo mostrado de uma forma diferente.
Step2: o cantareira tem capacidade ... |
10,714 | <ASSISTANT_TASK:>
Python Code:
a = [1,2,3]
b = [4,5,6]
c = a+b
print(c)
a.append(b)
print(a)
def sum(data):
sum the elements of an array
asum = 0.0
for i in data:
asum = asum + i
return asum
# the length of the array is defined here, and re-used below
# to test performance, we can make 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:
Step2: You can see, adding two lists just results in a longer list, catenation of the two.
|
10,715 | <ASSISTANT_TASK:>
Python Code:
n = input()
n = int(n)
l = [2, 3, -2, -7, 0, 2, 3]
def get_n_primes(N):
# TODO
assert(get_n_primes(3) == [2, 3, 5])
def get_nth_fibonacci(N):
# TODO
assert(get_nth_fibonacci(3) == 2)
def get_n_fibonacci(N):
# TODO
assert(get_n_fibonacci(4) == [1, 1, 2, 3])
def get_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: 2.1 Read a number N and print the numbers from 1 to N.
Step2: 3.2 Read numbers until 0 and collect them in a list. Print the elements backwards... |
10,716 | <ASSISTANT_TASK:>
Python Code:
!pip install --user statsmodels
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import datetime
%config InlineBackend.figure_format = 'retina'
df = pd.read_csv('gs://cloud-training/ai4f/AAPL10Y.csv')
df['date'] = pd.to_datetime(df['date'])
df.sor... | <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 data from Google Clod Storage
Step2: Prepare data for ARIMA
Step3: Let's create a column for weekly returns. Take the log to of the ret... |
10,717 | <ASSISTANT_TASK:>
Python Code:
import zarr; print('zarr', zarr.__version__)
import dask; print('dask', dask.__version__)
import dask.array as da
import numpy as np
# here's the real data
callset = zarr.open_group('/kwiat/2/coluzzi/ag1000g/data/phase1/release/AR3.1/variation/main/zarr2/zstd/ag1000g.phase1.ar3',
... | <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: Real data
Step2: Synthetic data
|
10,718 | <ASSISTANT_TASK:>
Python Code::
from sklearn.svm import SVC
from sklearn.metrics import classification_report
from sklearn.model_selection import GridSearchCV
# declare parameter ranges to try
params = {'C':[1, 2, 3],
'kernel':['linear', 'poly', 'rbf']}
# initialise estimator
svm_classifier = SVC(class_weight... | <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,719 | <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: 使用 Tensorflow Lattice 实现道德形状约束
Step2: 导入所需的软件包:
Step3: 本教程中使用的默认值:
Step4: 案例研究 1:法学院入学
Step5: 预处理数据集:
Step7: 将数据划分为训练/验证/测试集
Step8: 可视化数据分... |
10,720 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
import numpy as np
pm2 = pd.read_csv('http://archive.ics.uci.edu/ml/machine-learning-databases/00381/PRSA_data_2010.1.1-2014.12.31.csv',
na_values='NA')
pm2.columns = ['id', 'year', 'month', 'day', 'hour', 'pm2', 'dew_point', 'temperature',
... | <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: Attribute Information
Step2: There ore over 2000 samples with the pm 2.5 value missing
Step3: 2 - Suppose our data became corrupted after we d... |
10,721 | <ASSISTANT_TASK:>
Python Code:
from __future__ import division
from matplotlib import pyplot as plt
import numpy as np
import os
import urllib
import json
import pandas as pd
from random import shuffle, choice
import pickle
import sys; sys.path.insert(0, os.path.abspath('..'));
import validator.validator as val
%matplo... | <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. Generate Random Routes
Step2: Save or load a specific set of routes
Step3: 2. Grid Search for Optimal Parameter Values
Step4: 3. Plot the ... |
10,722 | <ASSISTANT_TASK:>
Python Code:
def testSomeNumbers(limit , n ) :
if(n < 3 ) :
return
for a in range(1 , limit + 1 ) :
for b in range(a , limit + 1 ) :
pow_sum = pow(a , n ) + pow(b , n )
c = pow(pow_sum , 1.0 / n )
c_pow = pow(int(c ) , n )
if(c_pow == pow_sum ) :
print("Count ▁ example ▁ found... | <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,723 | <ASSISTANT_TASK:>
Python Code:
# Python 2/3 compatibility
from __future__ import print_function, division, absolute_import
# import matplolib just in case
import matplotlib.pyplot as plt
# this line tells the notebook to plot matplotlib static plots in the notebook itself
%matplotlib inline
# this line does the same 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: The Marvin Query object allows you to specify a string search condition with which you want to look for results. It will construct the necessar... |
10,724 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import openmc
uo2 = openmc.Material(1, "uo2")
print(uo2)
mat = openmc.Material()
print(mat)
help(uo2.add_nuclide)
# Add nuclides to uo2
uo2.add_nuclide('U235', 0.03)
uo2.add_nuclide('U238', 0.97)
uo2.add_nuclide('O16', 2.0)
uo2.set_density('g/cm3', 10.0)
zirconium... | <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: Defining Materials
Step2: On the XML side, you have no choice but to supply an ID. However, in the Python API, if you don't give an ID, one wil... |
10,725 | <ASSISTANT_TASK:>
Python Code:
# Python 2 only:
print 'Hello'
# Python 2 and 3:
print('Hello')
# Python 2 only:
print 'Hello', 'Guido'
# Python 2 and 3:
from __future__ import print_function # (at top of module)
print('Hello', 'Guido')
# Python 2 only:
print >> sys.stderr, 'Hello'
# Python 2 and 3:
from __future__ ... | <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 print multiple strings, import print_function to prevent Py2 from interpreting it as a tuple
Step2: Raising exceptions
Step3: Raising excep... |
10,726 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import random
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
import scipy.linalg as linalg
import matplotlib
#NOT PART OF REGRESSION!
#Make up an equation and create data from it
x = np.linspace(0, 10, 20)
y = 2 * np.exp(-x**2 * 0.1) + scipy.stat... | <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: Linearizing An Exponential
Step2: NO, we cannot linearize and ignore the impact on noise
Step3: The Shapiro-Wilk test says absolutely not are ... |
10,727 | <ASSISTANT_TASK:>
Python Code:
import random
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from mesa import Model, Agent
from mesa.time import RandomActivation
from mesa.space import Grid
from mesa.datacollection import DataCollector
from mesa.batchrunner import BatchRunner
class TreeCell(Agent... | <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: Building the model
Step2: Now we need to define the model object itself. The main thing the model needs is the grid, which the trees are placed... |
10,728 | <ASSISTANT_TASK:>
Python Code:
## Code goes here
## Drivers & Runners
## Run Scripts, S3 Sync
## Code goes here
## Drivers & Runners
## Run Scripts, S3 Sync
## Code goes here
## Drivers & Runners
## Run Scripts, S3 Sync
## Code goes here
## Drivers & Runners
## Run Scripts, S3 Sync
## Code goes here
## Drivers & Ru... | <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 name="HW10.1.1"><h2 style="color
Step2: <a name="HW10.2"> <h2 style="color
Step3: <a name="HW10.3"><h2 style="color
Step4: <a name="HW10.4... |
10,729 | <ASSISTANT_TASK:>
Python Code:
BetaL = linspace(0,5,501)
det_exact = sin(pi*BetaL)-cos(pi*BetaL)*tanh(pi*BetaL)
det_approx = sin(pi*BetaL)-cos(pi*BetaL)
plt.plot(BetaL, det_exact, label='exact')
plt.plot(BetaL, det_approx, label='approx')
plt.xticks([0]+[n+0.25 for n in (1,2,3,4)])
plt.title('The determinant of the 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:
Step1: Not interested in the trivial solution $\beta_nL=0$, it's apparent that the roots are $\beta_nL\simeq(n+1/4)\pi$ but we can compute numerically ... |
10,730 | <ASSISTANT_TASK:>
Python Code:
from __future__ import division
import matplotlib.pyplot as plt
import matplotlib as mpl
import palettable
import numpy as np
import math
import seaborn as sns
from collections import defaultdict
%matplotlib inline
# Here, we customize the various matplotlib parameters for font sizes and ... | <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: Stem and leaf
Step3: Boxplot
|
10,731 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
from sklearn.pipeline import Pipeline
from sklearn.svm import SVC
from sklearn.decomposition import PCA
from sklearn.preprocessing import PolynomialFeatures
estimators = [('reduce_dIm', PCA()), ('pOly', PolynomialFeatures()), ('svdm', SVC())]
clf = 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:
|
10,732 | <ASSISTANT_TASK:>
Python Code:
# A few sample short texts with user comments on two Facebook pages
texts_telia = json.load(open('texts_telia.json', 'r'))
texts_tele2 = json.load(open('texts_tele2.json', 'r'))
res_anomalies = bw.anomalies(texts_telia, texts_tele2, max_words=10, min_score=1)
pprint(res_anomalies)
catego... | <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: Categories
Step2: Clusters
Step3: Counts
Step4: Entities
Step5: Sentiment
Step6: Topics
Step7: Wordcloud
|
10,733 | <ASSISTANT_TASK:>
Python Code:
from pyins import sim
from pyins.coord import perturb_ll
def generate_trajectory(n_points, min_step, max_step, angle_spread, random_state=0):
rng = np.random.RandomState(random_state)
xy = [np.zeros(2)]
angle = rng.uniform(2 * np.pi)
heading = [90 - angle]
angle_s... | <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: Assume that each step is done in 10 seconds and define time stamps
Step2: Add displacements to initial latitude and longitude
Step3: We also a... |
10,734 | <ASSISTANT_TASK:>
Python Code:
# Construire la matrice de notes
import pandas as pd
note=[[6,6,5,5.5],[8,8,8,8],[6,7,11,9.5],[14.5,14.5,15.5,15],
[14,14,12,12.5],[11,10,5.5,7],[5.5,7,14,11.5],[13,12.5,8.5,9.5],
[9,9.5,12.5,12]]
dat=pd.DataFrame(note,index=["jean","alai","anni","moni","didi","andr","pier","brig","... | <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.1 Valeurs propres et valeurs singulières de l'ACP non réduite
Step2: Les valeurs singulières associées à l'ACP sont celles de $(\bar{X}, I_p,... |
10,735 | <ASSISTANT_TASK:>
Python Code:
from IPython.core.display import Image, display
display(Image(url='images/taller-oct-6/fig-20-15.png'))
from IPython.core.display import Image, display
display(Image(url='images/taller-oct-6/long-channel-mosfet.png'))
from IPython.core.display import Image, display
display(Image(url='ima... | <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: Caracteristicas usadas en las simulaciones
Step2: Simulacion en NGSPICE
Step3: Fig-20-15-LEVEL-3.cir Transitorio de 0 a 1n Segundo, condicines... |
10,736 | <ASSISTANT_TASK:>
Python Code:
from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
%matplotlib inline
# here the usual imports. If any of the imports fails, make sure that pynoddy is installed
# properly, ideally with 'python setup.py develop' or 'python setup.py install'
imp... | <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: Creating an experiment object
Step2: Some basic information about the model can be obtained with
Step3: We can have a quick look at the model ... |
10,737 | <ASSISTANT_TASK:>
Python Code:
!pip install git+https://github.com/google/learned_optimization.git
import numpy as np
import jax.numpy as jnp
import jax
from matplotlib import pylab as plt
from learned_optimization.outer_trainers import full_es
from learned_optimization.outer_trainers import truncated_pes
from learned_... | <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: Defining a custom Dataset
Step2: Defining a custom Task
Step4: Meta-training on multiple tasks
Step5: With this task family defined, we can c... |
10,738 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
import holoviews as hv
hv.notebook_extension('bokeh')
from holoviews.plotting.bokeh.element import (line_properties, fill_properties,
text_properties)
print(
Line properties: %s\n
Fill proper... | <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: We could instead leave the default backend as 'matplotlib', and then switch only some specific cells to use bokeh using a cell magic
Step3: He... |
10,739 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
mlo, gl = pd.read_csv('../data/co2-mm-mlo.csv', na_values=-99.99, index_col='Date', parse_dates=True), \
pd.read_csv('../data/co2-mm-gl.csv', na_values=-99.99, index_col='Date', parse_dates=True)
# pd.read_csv('https://python.g-node.org/wiki/_media/co2-mm-mlo.... | <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: Joining
Step2: We can concatenate the two DataFrames.
Step3: Alternatively, the above can be obtained with the self-describing append() method... |
10,740 | <ASSISTANT_TASK:>
Python Code:
# Tell matplotlib to plot in line
%matplotlib inline
# import pandas
import pandas
# seaborn magically adds a layer of goodness on top of Matplotlib
# mostly this is just changing matplotlib defaults, but it does also
# provide some higher level plotting methods.
import seaborn
# Tell sea... | <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: I am really enjoying having this weather station. I say weather
Step3: Temperature
Step4: The latitude is almost in phase with the phase of t... |
10,741 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score
from sklearn.cross_validation import StratifiedKFold
import mne
from mne.datasets import sample
from mne.decoding import TimeDecoding, GeneralizationAcrossTime
data_path = sample.data_path()
plt.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: Set parameters
Step2: Temporal decoding
Step3: Generalization Across Time
|
10,742 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
import numpy as np
from sklearn import datasets
from sklearn import model_selection
import seaborn as sns
sns.set_style('whitegrid')
sns.despine()
from ibex import trans
from ibex.sklearn import linear_model as pd_linear_model
from ibex.sklearn import decomposition as ... | <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: Loading The Data
Step2: Building The Cross Validated Predictions
Step3: Plotting The Cross-Validated Predictions
|
10,743 | <ASSISTANT_TASK:>
Python Code:
names = {}
for node in graph:
for edge in node:
if edge.guid == "169a81aefca74e92b45e3fa03c7021df":
value = node[edge].value
if value in names:
raise ValueError('name: "{}" defined twice'.format(value))
names[value] = node
... | <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: Pikov Classes
Step2: Gamekitty
Step3: Create frames for each "clip"
|
10,744 | <ASSISTANT_TASK:>
Python Code:
# import necessary libraries
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns
# Load TMDb data and print out a few lines. Perform operations to inspect data
# types and look for instances of missing or possibly errant 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: <a id='wrangling'></a>
Step3: Data Cleaning
Step4: Convert cast, genres, director and production_companies columns to array
Step5: <a id='eda... |
10,745 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
from scipy import ndimage as nd
from matplotlib import pyplot as plt
!wget https://github.com/jeanpat/DeepFISH/blob/master/dataset/Cleaned_FullRes_2164_overlapping_pairs.npz?raw=true
!mv Cleaned_FullRes_2164_overlapping_pairs.npz?raw=true Clean2164.npz
# There's a trick... | <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: Have a look to the downloaded images
Step2: The same dataset saved as a hdf5 file can be downloaded
|
10,746 | <ASSISTANT_TASK:>
Python Code:
import logging
import os
import re
import time
from collections import Counter, defaultdict
from operator import itemgetter
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from fuzzywuzzy import process, fuzz
from matplotlib_venn import venn2
import pybel
from py... | <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: Notebook Provenance
Step2: Local Path Definitions
Step3: PyBEL Resources
Step4: Data
Step5: Error Analysis
Step6: The types of errors in a ... |
10,747 | <ASSISTANT_TASK:>
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 ... | <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: Image Classification
Step2: Explore the Data
Step5: Implement Preprocess Functions
Step8: One-hot encode
Step10: Randomize Data
Step12: Che... |
10,748 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from IPython.display import display, HTML
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (14.0, 8.0)
import numpy as np
from datetime import datetime
from dtocean_core import start_logging
from dtocean_core.core import Core
from dtocean_core.menu 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: Create the core, menus and pipeline tree
Step2: Create a new project and tree
Step3: Set the device type
Step4: Initiate the pipeline
Step5: ... |
10,749 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import gammainc, gammaincinv
from scipy.integrate import quad
import pandas as pd
import pastas as ps
%matplotlib inline
rain = ps.read.read_knmi('data_notebook_5/etmgeg_260.txt', variables='RH').series
evap = ps.read.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: Defining required functions
Step2: Comparing the Gamma and the Four Parameter response function
Step3: Create Pastas model
Step4: The results... |
10,750 | <ASSISTANT_TASK:>
Python Code:
# jupyter magic
%matplotlib inline
# python scientific stack
import numpy as np
import pandas as pd
import scipy.stats as scs
import statsmodels
import statsmodels.api as sm
import statsmodels.formula.api as smf
import statsmodels.stats as sms
# fileformat
from simpledbf import Dbf5
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: Labo 2
Step2: Dataframe manipulation
Step3: Normality
Step4: Kurtosis
Step5: Kolmogorov-Smirnov
Step6: Shapiro-Wilk
Step7: Transformations... |
10,751 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'pcmdi', 'sandbox-2', '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,752 | <ASSISTANT_TASK:>
Python Code:
%gui asyncio
from flexx import event
class MyObject(event.Component):
@event.reaction('!foo')
def on_foo(self, *events):
print('received the foo event %i times' % len(events))
ob = MyObject()
for i in range(3):
ob.emit('foo', {})
ob.on_foo()
class MyObject(even... | <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: Events
Step2: Note how the reaction is connected using a "connection string", which (in this case) indicates we connect to the type "foo" event... |
10,753 | <ASSISTANT_TASK:>
Python Code:
import sys
sys.path.append('..')
import socnet as sn
sn.graph_width = 400
sn.graph_height = 225
sn.edge_width = 1
g = sn.load_graph('teste.gml', has_pos=True)
sn.show_graph(g)
def calculate_partial_betweenness(g, s):
# Esta função deve calcular o betweenness parcial de cada aresta
... | <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: Configurando a biblioteca
Step2: Carregando o primeiro grafo
Step3: Você pode usar esse grafo para depurar sua implementação do cálculo de edg... |
10,754 | <ASSISTANT_TASK:>
Python Code:
from ga4gh.client import client
c = client.HttpClient("http://1kgenomes.ga4gh.org")
#Obtain dataSet id REF: -> `1kg_metadata_service`
dataset = c.search_datasets().next()
for feature_set in c.search_feature_sets(dataset_id=dataset.id):
print feature_set
if feature_set.name == "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: Search Feature Sets
Step2: Get Feature Set by ID
Step3: Search Features
Step4: Note
|
10,755 | <ASSISTANT_TASK:>
Python Code:
timings.columns= ['np', 'matrix', 'solver', 'prec', 'status', 'time', 'iters', 'resid']
properties.columns = ['rows', 'cols', 'min_nnz_row', 'row_var', 'col_var', 'diag_var', 'nnz', 'frob_norm', 'symm_frob_norm', 'antisymm_frob_norm', 'one_norm', 'inf_norm', 'symm_inf_norm', 'antisymm_inf... | <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: Combining the two dataframes into a single dataframe called 'combined.'
Step2: None of the above should be changed
Step3: So let's see how big... |
10,756 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
r_cols = ['user_id', 'movie_id', 'rating']
ratings = pd.read_csv('e:/sundog-consult/udemy/datascience/ml-100k/u.data', sep='\t', names=r_cols, usecols=range(3), encoding="ISO-8859-1")
m_cols = ['movie_id', 'title']
movies = pd.read_csv('e:/sundog-consult/udemy/datascie... | <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 we'll pivot this table to construct a nice matrix of users and the movies they rated. NaN indicates missing data, or movies that a given use... |
10,757 | <ASSISTANT_TASK:>
Python Code:
%less ../datasets/vmstat_loadtest.log
from ozapfdis.linux import vmstat
stats = vmstat.read_logfile("../datasets/vmstat_loadtest.log")
stats.head()
cpu_data = stats.iloc[:, -5:]
cpu_data.head()
%matplotlib inline
cpu_data.plot.area();
<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: Data Input
Step2: Data Selection
Step3: Visualization
|
10,758 | <ASSISTANT_TASK:>
Python Code:
import graphlab
loans = graphlab.SFrame('lending-club-data.gl/')
loans.column_names()
loans['safe_loans'] = loans['bad_loans'].apply(lambda x : +1 if x==0 else -1)
loans = loans.remove_column('bad_loans')
target = 'safe_loans'
features = ['grade', # grade of the lo... | <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 LendingClub dataset
Step2: Let's quickly explore what the dataset looks like. First, let's print out the column names to see what features... |
10,759 | <ASSISTANT_TASK:>
Python Code:
#This block of code will set up a spark content and sql context if you are running locally
#If you are on cluster or have deployed spark a different way you don't need this
from pyspark import SparkContext, SparkConf
from pyspark.sql import SQLContext
try:
sc = SparkContext()
except... | <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: Read in the data - for instance the MovieLens data can be found at
Step2: Set up all of the parameters necessary for the runner
Step3: Pass in... |
10,760 | <ASSISTANT_TASK:>
Python Code:
some_list = [10,20,30]
print(some_list[2])
some_list = [10,20,30]
print(some_list[0])
some_list = [10,20,30]
print(some_list[-1])
some_list = [10,20,30,40]
print(some_list[1:3])
some_list = [10,20,30]
print(some_list[:3])
some_list = [0,10,20,30,40,50,60,70]
print(some_list[2:4])
some_l... | <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: Summarize
Step2: Summarize
Step3: Setting values in lists
Step4: Predict what this code does.
Step5: Predict what this code does.
Step6: Su... |
10,761 | <ASSISTANT_TASK:>
Python Code:
# Setup feedback system
from learntools.core import binder
binder.bind(globals())
from learntools.computer_vision.ex6 import *
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.layers.experimental import preprocessing
# Imports
import os, warnings
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: (Optional) Explore Augmentation
Step2: Do the transformations you chose seem reasonable for the Car or Truck dataset?
Step3: The TensorFlow Fl... |
10,762 | <ASSISTANT_TASK:>
Python Code:
#我的Python版本是:
import sys
print(sys.version)
print(sys.version_info)
import itchat
itchat.auto_login()
friends = itchat.get_friends(update=True)[0:]
friends[0]
import os
user = friends[0]["PYQuanPin"][0:]
print(user)
os.mkdir(user)
os.chdir(user)
os.getcwd()
for i in friends:
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: =======注意=======
Step2: 使用friends储存好友列表,update=True可以确保好友列表是最新的。注意好友列表第0个是自己
Step3: friends好友列表第0个是自己,我们可以看一下。顺带说一下,好友列表的顺序 (貌似) 是按照好友添加顺序
Ste... |
10,763 | <ASSISTANT_TASK:>
Python Code:
from IPython.display import HTML
from IPython.display import Image
from PIL import Image as ImagePIL
%pylab
%matplotlib inline
G = 4.32 #гравитационная постоянная в нужных единицах
def Qs(epicycl=None, sigma=None, star_density=None):
'''Вычисление безразмерного параметра Тумре для зв... | <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: Нахождение максимума
Step4: Теперь кинематическое приближение
Step5: У Rafikov... |
10,764 | <ASSISTANT_TASK:>
Python Code:
!pip3 install kaggle
!pip3 install google
from google.colab import files
upload = files.upload()
!mkdir ~/.kaggle
!cp kaggle.json ~/.kaggle/
!chmod 600 ~/.kaggle/kaggle.json
!kaggle competitions download -c human-protein-atlas-image-classification
!mkdir ./human_protein_atlas/
!mkdir .... | <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: Authenticate Kaggle by uploading kaggle.json file
Step2: Download dataset
Step3: Unzip files
Step4: Notebook
Step5: Load dataset info
Step6:... |
10,765 | <ASSISTANT_TASK:>
Python Code:
import torch
import tensorflow as tf
from torch.autograd import Variable
import numpy as np
def f(X):
return X*X
def g(X):
return X**3
X = np.random.randn(10)
X
sess = tf.InteractiveSession()
tf_X = tf.Variable(X)
init_op = tf.global_variables_initializer()
sess.run(init_op)
sess... | <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: Tensorflow implementation
Step2: Modify the gradients
Step3: Gradient reversal
Step4: Pytoch case
Step5: Modify gradients
Step6: Gradient r... |
10,766 | <ASSISTANT_TASK:>
Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cams', 'sandbox-2', 'landice')
# Set as follows: DOC.set_author("name", "email")
# TODO - please enter value(s)
# Set as follows: DOC.set_contributor("name", "em... | <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,767 | <ASSISTANT_TASK:>
Python Code:
#!pip install -I "phoebe>=2.4,<2.5"
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger()
b = phoebe.default_binary()
b.filter(qualifier='asini', context='constraint')
b.get_parameter(qualifier='asini', component='binary',... | <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: Built-in Constraints
Step3: esinw, ecosw
Step4: t0
Step5: freq
... |
10,768 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from hciplot import plot_frames, plot_cubes
from matplotlib.pyplot import *
from matplotlib import pyplot as plt
import numpy as np
from packaging import version
import vip_hci as vip
vvip = vip.__version__
print("VIP version: ", vvip)
if version.parse(vvip) < version.... | <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: In the following box we import all the VIP routines that will be used in this tutorial.
Step2: 6.1. Introduction
Step3: 6.2.1. Symmetric pole-... |
10,769 | <ASSISTANT_TASK:>
Python Code:
import rebound
sim = rebound.Simulation()
sim.integrator = "whfast"
sim.add(m=1.)
sim.add(m=1e-6,a=1.)
sim.move_to_com() # Moves to the center of momentum frame
ps = sim.particles
c = 0.01
def starkForce(reb_sim):
ps[1].ax += c
sim.additional_forces = starkForce
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: We could integrate this system and the planet would go around the star at a fixed orbit with $a=1$ forever. Let's add an additional constant for... |
10,770 | <ASSISTANT_TASK:>
Python Code:
!pip install --pre deepchem[tensorflow]
import deepchem as dc
dc.__version__
tasks, datasets, transformers = dc.molnet.load_delaney(featurizer='GraphConv')
train_dataset, valid_dataset, test_dataset = datasets
model = dc.models.GraphConvModel(n_tasks=1, mode='regression', dropout=0.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: You can of course run this tutorial locally if you prefer. In this case, don't run the above cell since it will download and install Anaconda on... |
10,771 | <ASSISTANT_TASK:>
Python Code:
from IPython.display import display, HTML
display(HTML('''<img src="image1.png",width=800,height=500">'''))
import numpy as np # numerical libraries
import pandas as pd # for data analysis
import matplotlib as mpl # a big library with plotting functionality
import matplotlib.pyplot as 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: Description
Step2: Load data and take a peak at it.
Step3: Separate data into training, validation, and test sets. (This division is not used ... |
10,772 | <ASSISTANT_TASK:>
Python Code:
import os
PROJECT_ID = "michaelabel-gcp-training"
os.environ["PROJECT_ID"] = PROJECT_ID
import sys
import warnings
warnings.filterwarnings('ignore')
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# If you are running this notebook in Colab, follow the
# instructions to authenticate your GCP ... | <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 you are using Colab, run the cell below and follow the instructions
Step2: Create a Cloud Storage bucket
Step3: Run the following cell to c... |
10,773 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import numpy as np
from matplotlib import cm
import matplotlib.pyplot as plt
import seaborn as sns
from progress_bar import log_progress
import FeedforwardNN
nodes = 9 # Number of nodes in our hidden layer
alpha = 5 # Learning Rate
num_epochs = 1000 # Maximum number... | <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: Hyperparameters
Step2: Creating the network
Step3: Testing on the XOR function
Step4: Optimizing the network for XOR function
|
10,774 | <ASSISTANT_TASK:>
Python Code:
from QGL import *
import QGL
import os.path
import pickle
QGL.drivers.APS2Pattern.SAVE_WF_OFFSETS = True
cl = ChannelLibrary(":memory:")
q1 = cl.new_qubit("q1")
aps2_1 = cl.new_APS2("BBNAPS1", address="192.168.5.101")
aps2_2 = cl.new_APS2("BBNAPS2", address="192.168.5.102")
dig_1 = cl.... | <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: Create the usual channel library with a couple of AWGs.
Step2: Compile a simple sequence.
Step3: Open the offsets file (in the same directory ... |
10,775 | <ASSISTANT_TASK:>
Python Code:
import random
import string
def random_char():
return random.choice(string.ascii_lowercase + ' ')
def genera_frase():
return [random_char() for n in range(0,len(amleto))]
amleto = list('parmi somigli ad una donnola')
print("target= '"+''.join(amleto)+"'")
frase = genera_frase()
pr... | <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: E poi proporre la nostra frase all’insegnante il quale si limita a
Step2: Ben presto ci accorgiamo di quanta pazienza devono avere le scimmie, ... |
10,776 | <ASSISTANT_TASK:>
Python Code:
import matplotlib.pyplot as plt
import matplotlib.colors
import numpy as np
import os
import scipy.io as sio
import sys
import time
import inspect
import pandas as pd
from tqdm import *
# Plot entire array
np.set_printoptions(threshold=np.nan)
import seaborn as sns
sns.set_palette('spectr... | <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: Step 1) Load the data from bicorr1
Step2: To remind ourselves what this file contains, the columns are
Step3: I used a numpy array. That's kin... |
10,777 | <ASSISTANT_TASK:>
Python Code:
from jyquickhelper import add_notebook_menu
add_notebook_menu()
%matplotlib inline
from pandas import DataFrame
rows = [{'col1': 0.5, 'col2': 'schtroumph'},
{'col1': 0.6, 'col2': 'schtroumphette'}]
DataFrame(rows)
%%writefile data.csv
col1,col2
0.5,alpha
0.6,beta
import os
os.ge... | <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: Enoncé
Step2: La lecture depuis un fichier
Step3: La maîtrise des index
Step4: Accès par ligne (uniquement avec
Step5: Accès par positions... |
10,778 | <ASSISTANT_TASK:>
Python Code:
#Add all dependencies to PYTHON_PATH
import sys
sys.path.append("/usr/lib/spark/python")
sys.path.append("/usr/lib/spark/python/lib/py4j-0.10.4-src.zip")
sys.path.append("/usr/lib/python3/dist-packages")
#Define environment variables
import os
os.environ["HADOOP_CONF_DIR"] = "/etc/hadoop/... | <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: Connect to Spark
|
10,779 | <ASSISTANT_TASK:>
Python Code:
def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) // 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
quicksort... | <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: Python versions
Step2: Basic data types
Step3: Note that unlike certain other languages like <tt>C</tt>, <tt>C++</tt>, <em>Java</em>, or <tt>C... |
10,780 | <ASSISTANT_TASK:>
Python Code:
from IPython.display import Image
# Add your filename and uncomment the following line:
Image(filename='graph1.png')
<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: Graphical excellence and integrity
|
10,781 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from utility.plot import plot_all
#Plotting Bulbassaur ID = 1
plot_all(1)
#Plotting Charmander ID = 4
plot_all(4)
#Plotting Squirtle ID = 7
plot_all(7)
%matplotlib inline
from utility.plot import plot_chain
plot_chain("gen05_black-white",[1,2,3])
%matplotlib inline
fr... | <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 take a look at the sprites of an Evolutionary Chain.
Step2: On this step, we will build and test our pre-processing pipeline. Its goa... |
10,782 | <ASSISTANT_TASK:>
Python Code:
!pip install tensorflow-addons
import os
# slightly faster improvements, on the first epoch 30 second decrease and a 1-2 second
# decrease in epoch time. Overall saves approx. 5 min of training time
# Allocates two threads for a gpu private which allows more operations to be
# done faster... | <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 CIFAR-10 dataset
Step2: Necessary Hyperparameters
Step18: Augmentation Utilities
Step20: Data Loading
Step21: View examples of data... |
10,783 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
a = np.random.rand(3, 3, 3)
b = np.arange(3*3*3).reshape((3, 3, 3))
sort_indices = np.argsort(a, axis=0)[::-1, :, :]
static_indices = np.indices(a.shape)
c = b[sort_indices, static_indices[1], static_indices[2]]
<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,784 | <ASSISTANT_TASK:>
Python Code:
from compare_simulators import CalculatorComparator
from population_simulator import CerfaPopulationSimulator
from utils import show_histogram
from utils import percent_diff
from utils import scatter_plot
import matplotlib.pyplot as plt
import numpy as np
import random
%matplotlib inline
... | <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 population data
Step2: Extracts concepts of interest
Step3: Plots Revenu disponible before reform
Step4: Define your reform here !
Step5... |
10,785 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
import numpy as np
% matplotlib inline
from matplotlib import pyplot as plt
from sklearn import preprocessing as pp
def read_data(path, with_preview=False):
data = pd.read_csv(path)
data.columns = data.columns.str.upper()
return data
data = rea... | <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 Read data
Step2: 3 Extracting features from the MATCHUP column
Step3: 3 Dealing categorical features
Step4: 3.1 Factorizing
Step5: As we c... |
10,786 | <ASSISTANT_TASK:>
Python Code:
# A bit of setup
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.neural_net import TwoLayerNet
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] ... | <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: Implementing a Neural Network
Step2: We will use the class TwoLayerNet in the file cs231n/classifiers/neural_net.py to represent instances of o... |
10,787 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
# redefining the example objects
# series
population = pd.Series({'Germany': 81.3, 'Belgium': 11.3, 'France': 64.3,
'United Kingdom': 64.9, 'Netherlands': 16.9})
# dataframe
data = {'country': ['Belgium', 'France', 'Germany', 'Netherlands', 'U... | <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: Combining data is essential functionality in a data analysis workflow.
Step2: Adding columns
Step3: Adding multiple columns at once is also p... |
10,788 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
raw_data = {'officer_name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'],
'jan_arrests': [4, 24, 31, 2, 3],
'feb_arrests': [25, 94, 57, 62, 70],
'march_arrests': [5, 43, 23, 23, 51]}
df = pd.DataF... | <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: Create dataframe
Step2: Make plot
|
10,789 | <ASSISTANT_TASK:>
Python Code:
!pip install -I "phoebe>=2.2,<2.3"
import phoebe
from phoebe import u # units
b = phoebe.default_binary()
b.add_dataset('lc', times=phoebe.linspace(0,10,101), dataset='lc01')
print(b.filter(qualifier=['times', 'compute_times'], context='dataset'))
b.set_value('compute_times', phoebe.lin... | <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 create a new Bundle. See Building a System for more details.
Step2: Overriding Computation Times
Step3: compu... |
10,790 | <ASSISTANT_TASK:>
Python Code:
# Versão da Linguagem Python
from platform import python_version
print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version())
# Definindo uma função - 3 linhas de código
def potencia(num):
result = num**2
return result
potencia(5)
# Definindo uma função - 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: Expressões Lambda
|
10,791 | <ASSISTANT_TASK:>
Python Code:
y = np.load('../data/y.npy')
sigma = np.load('../data/sigma.npy')
sigma_inv = np.load('../data/sigma_inv.npy')
T = 90 # Steps
K = 2 # Changepoints
P = 10 # Variables
M = 5 # Active Edges
eps = 0.000001 # Edge threshold epsilon
edges = get_edges(sigma_inv[0], eps)
change_points = get_chan... | <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: True Changepoints
Step2: Estimated Changepoints with GFGL smoother
Step3: Visualising Graphical Models
Step4: Note that we only select three ... |
10,792 | <ASSISTANT_TASK:>
Python Code:
%pylab inline
from scipy import stats
from ipywidgets import interact, fixed
def sample_distributions(mu_neg, mu_pos, sd_neg, sd_pos,
n_neg, n_pos, fnr, fpr,
clip_low, clip_high):
Returns subsamples and observations from two normal
... | <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: The way you define groups affects your statistical tests
Step3: A perfect experiment
Step4: A $t$-test between samples of these populations is... |
10,793 | <ASSISTANT_TASK:>
Python Code:
import pandas as pd
import numpy as np
import networkx as nx
from copy import deepcopy
import matplotlib.pyplot as plt
%matplotlib inline
from matplotlib.backends.backend_pdf import PdfPages
from glob import glob
fileName = 'article0'
def getFiles(fileName):
matches = glob('*'+fileNam... | <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: degree centrality
Step2: closeness centrality
Step3: betweenness centrality
Step4: degree assortativity coefficient
|
10,794 | <ASSISTANT_TASK:>
Python Code:
from ga4gh.client import client
c = client.HttpClient("http://1kgenomes.ga4gh.org")
dataset = c.search_datasets().next()
print dataset
data_set_id = dataset.id
dataset_via_get = c.get_dataset(dataset_id=data_set_id)
print dataset_via_get
<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: We will continue to refer to this client object for accessing the remote server.
Step2: NOTE
|
10,795 | <ASSISTANT_TASK:>
Python Code:
# install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import exists
filename = 'modsim.py'
if not exists(filename):
from urllib.request import urlretrieve
url = 'https://raw.githubusercontent.com/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: In the previous chapter we modeled objects moving in one dimension, with and without drag. Now let's move on to two dimensions, and baseball!
St... |
10,796 | <ASSISTANT_TASK:>
Python Code:
import os
import nltk
directories = ['train/pos', 'train/neg', 'test/pos', 'test/neg', 'train/unsup']
input_file = open('../data/alldata.txt', 'w')
id_ = 0
for directory in directories:
rootdir = os.path.join('../data/aclImdb', directory)
for subdir, dirs, files in os.walk(rootdir... | <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: doc2vec
Step2: Prediction
Step3: The documents vector are going to be identified by the id we used in the preprocesing section, for example do... |
10,797 | <ASSISTANT_TASK:>
Python Code:
%matplotlib inline
from astropy.table import Table
import numpy as np
import matplotlib.pyplot as plt
data3 = Table.read('/Users/gtr/Work/sdss/mastercat/GTR-ADM-QSO-master-sweeps-Feb5-2016.zspeconly.fits')
print len(data3)
#data3.keys()
# Get rid of objects with negative fluxes
mask = ( (... | <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: Convert from maggies to magnitudes, use the "clean" fluxes when available, but only if >0 to avoid problems with logs.
Step2: Cut some question... |
10,798 | <ASSISTANT_TASK:>
Python Code:
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import networkx as nx
K_5=nx.complete_graph(5)
nx.draw(K_5)
def complete_deg(n):
Return the integer valued degree matrix D for the complete graph K_n.
a = np.zeros((n,n))
b = a.astype... | <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: Complete graph Laplacian
Step3: The Laplacian Matrix is a matrix that is extremely important in graph theory and numerical analysis. It is defi... |
10,799 | <ASSISTANT_TASK:>
Python Code:
from IPython.display import Image
# 게시글 제목
title = "On top of the world! Life is so fantastic if you just let it. \
I have never been happier. #nyc #newyork #vacation #traveling"
# Write your code below.
# 모스부호
morse = {
'.-':'A','-...':'B','-.-.':'C','-..':'D','.':'E','..-.':'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: References
Step2: 1.3 Morse
Step3: 1.4 Card Deck
Step4: 1.5 문장 안의 단어 개수
Step5: 1.6 단어의 순서를 바꿔 출력
Step6: 1.7 단어의 순서와 그 단어의 글자 순서 바꿔 출력
Step7... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.