code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# Write a program to remove characters from a string starting from zero up to n and return a new string.
__Example:__
remove_char("Untitled", 4) so output must be tled. Here we need to remove first four characters from a string
```
def remove_char(a, b):
# Write your code here
print("started")
a="Untitled"
... | github_jupyter |
# Pattern Mining
## Library
```
source("https://raw.githubusercontent.com/eogasawara/mylibrary/master/myPreprocessing.R")
loadlibrary("arules")
loadlibrary("arulesViz")
loadlibrary("arulesSequences")
data(AdultUCI)
dim(AdultUCI)
head(AdultUCI)
```
## Removing attributes
```
AdultUCI$fnlwgt <- NULL
AdultUCI$"educatio... | github_jupyter |
```
# %load CommonFunctions.py
# # COMMON ATOMIC AND ASTRING FUNCTIONS
# In[14]:
############### One String Pulse with width, shift and scale #############
def StringPulse(String1, t: float, a = 1., b = 0., c = 1., d = 0.) -> float:
x = (t - b)/a
if (x < -1):
res = -0.5
elif (x > 1):
res... | github_jupyter |
<a href="https://colab.research.google.com/github/yohanesnuwara/reservoir-geomechanics/blob/master/delft%20course%20dr%20weijermars/stress_tensor.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import numpy as np
import matplotlib.pyplot as plt
... | github_jupyter |
# AutoGluon Tabular with SageMaker
[AutoGluon](https://github.com/awslabs/autogluon) automates machine learning tasks enabling you to easily achieve strong predictive performance in your applications. With just a few lines of code, you can train and deploy high-accuracy deep learning models on tabular, image, and text... | github_jupyter |
<a href="https://colab.research.google.com/gist/taruma/b00880905f297013f046dad95dc2e284/taruma_hk73_bmkg.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Berdasarkan isu [#73](https://github.com/taruma/hidrokit/issues/73): **request: mengolah berkas ... | github_jupyter |
# Homework - Random Walks (18 pts)
## Continuous random walk in three dimensions
Write a program simulating a three-dimensional random walk in a continuous space. Let 1000 independent particles all start at random positions within a cube with corners at (0,0,0) and (1,1,1). At each time step each particle will move i... | github_jupyter |
- 使用ngram进行恶意域名识别
- 参考论文:https://www.researchgate.net/publication/330843380_Malicious_Domain_Names_Detection_Algorithm_Based_on_N_-Gram
```
import numpy as np
import pandas as pd
import tldextract
import matplotlib.pyplot as plt
import os
import re
import time
from scipy import sparse
%matplotlib inline
```
## 加载数据
... | github_jupyter |
# Data preparation for tutorial
This notebook contains the code to convert raw downloaded external data into a cleaned or simplified version for tutorial purposes.
The raw data is expected to be in the `./raw` sub-directory (not included in the git repo).
```
%matplotlib inline
import pandas as pd
import geopandas... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"></ul></div>
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="images/book_cover.jpg" width="120">
*This notebook contains an excerpt from the [Python Programming and Numerical Methods - A Guide for E... | github_jupyter |
# Another attempt at MC Simulation on AHP/ANP
The ideas are the following:
1. There is a class MCAnp that has a sim() method that will simulate any Prioritizer
2. MCAnp also has a sim_fill() function that does fills in the data needed for a single simulation
## Import needed libs
```
import pandas as pd
import sys ... | github_jupyter |
# Laboratorio 5
## Datos: _European Union lesbian, gay, bisexual and transgender survey (2012)_
Link a los datos [aquí](https://www.kaggle.com/ruslankl/european-union-lgbt-survey-2012).
### Contexto
La FRA (Agencia de Derechos Fundamentales) realizó una encuesta en línea para identificar cómo las personas lesbianas... | github_jupyter |
# Talktorial 1
# Compound data acquisition (ChEMBL)
#### Developed in the CADD seminars 2017 and 2018, AG Volkamer, Charité/FU Berlin
Paula Junge and Svetlana Leng
## Aim of this talktorial
We learn how to extract data from ChEMBL:
* Find ligands which were tested on a certain target
* Filter by available bioact... | github_jupyter |
<a href="https://colab.research.google.com/github/BreakoutMentors/Data-Science-and-Machine-Learning/blob/main/machine_learning/lesson%204%20-%20ML%20Apps/Gradio/EMNIST_Gradio_Tutorial.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Making ML Appli... | github_jupyter |
# Baixando a base de dados do Kaggle
```
# baixando a lib do kaggle
!pip install --upgrade kaggle
!pip install plotly
# para visualizar dados faltantes
!pip install missingno
# requisitando upload do token de autentificação do Kaggle
# OBS: o arquivo kaggle.json precisa ser baixado da sua conta pessoal do Kaggle.
fro... | github_jupyter |
# Backprop Core Example: Text Summarisation
Text summarisation takes a chunk of text, and extracts the key information.
```
# Set your API key to do inference on Backprop's platform
# Leave as None to run locally
api_key = None
import backprop
summarisation = backprop.Summarisation(api_key=api_key)
# Change this up.... | github_jupyter |
```
%pylab --no-import-all
%matplotlib inline
import PyDSTool as pdt
ab = np.loadtxt('birdsynth/test/ba_example_ab.dat')
#ab = np.zeros((40000, 2))
ab[:, 0] += np.random.normal(0, 0.01, len(ab))
t_mom = np.linspace(0, len(ab)/44100, len(ab))
inputs = pdt.pointset_to_traj(pdt.Pointset(coorddict={'a': ab[:, 1], 'b':ab[:,... | github_jupyter |
# Bayesian Hierarchical Modeling
This jupyter notebook accompanies the Bayesian Hierarchical Modeling lecture(s) delivered by Stephen Feeney as part of David Hogg's [Computational Data Analysis class](http://dwh.gg/FlatironCDA). As part of the lecture(s) you will be asked to complete a number of tasks, some of which w... | github_jupyter |
# Detecting Loops in Linked Lists
In this notebook, you'll implement a function that detects if a loop exists in a linked list. The way we'll do this is by having two pointers, called "runners", moving through the list at different rates. Typically we have a "slow" runner which moves at one node per step and a "fast" ... | github_jupyter |
```
import numpy as np
from scipy.stats import norm
import matplotlib.pylab as plt
import pandas as pd
from bokeh.layouts import row, widgetbox, layout, gridplot
from bokeh.models import CustomJS, Slider
from bokeh.plotting import figure, output_file, show, ColumnDataSource
from bokeh.models.glyphs import MultiLine
fro... | github_jupyter |
<a href="https://colab.research.google.com/github/google-research/tapas/blob/master/notebooks/sqa_predictions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
##### Copyright 2020 The Google AI Language Team Authors
Licensed under the Apache License... | github_jupyter |
# Tutorial Part 6: Going Deeper On Molecular Featurizations
One of the most important steps of doing machine learning on molecular data is transforming this data into a form amenable to the application of learning algorithms. This process is broadly called "featurization" and involves tutrning a molecule into a vector... | github_jupyter |
# Neural Networks
In the previous part of this exercise, you implemented multi-class logistic re gression to recognize handwritten digits. However, logistic regression cannot form more complex hypotheses as it is only a linear classifier.<br><br>
In this part of the exercise, you will implement a neural network to rec... | github_jupyter |
[View in Colaboratory](https://colab.research.google.com/github/neoaksa/IMDB_Spider/blob/master/Movie_Analysis.ipynb)
```
# I've already uploaded three files onto googledrive, you can use uploaded function blew to upload the files.
# # upload
# uploaded = files.upload()
# for fn in uploaded.keys():
# print('User u... | github_jupyter |
```
#%%
from dataclasses import dataclass, field
import numpy as np
from sklearn import metrics
import numpy as np
from tqdm import tqdm
import random
from typing import List, Dict
from sklearn.utils import resample
from scipy.special import expit
from shared import bootstrap_auc
from sklearn.model_selection import tra... | github_jupyter |
```
# This cell is added by sphinx-gallery
!pip install mrsimulator --quiet
%matplotlib inline
import mrsimulator
print(f'You are using mrsimulator v{mrsimulator.__version__}')
```
# ²⁹Si 1D MAS spinning sideband (CSA)
After acquiring an NMR spectrum, we often require a least-squares analysis to
determine site po... | github_jupyter |
<a href="https://colab.research.google.com/github/lamahechag/pytorch_tensorflow/blob/master/pytorch.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Pytorch
Pytorch is a framework that challenge you to build a ANN almost from scratch.
This tutori... | github_jupyter |
```
import pandas as pd
import scipy.stats as st
import matplotlib.pyplot as plt
import numpy as np
import operator
```
# Crimes
### Svetozar Mateev
## Putting Crime in the US in Context
First I am going to calculate the total crimes by dividing the population by 100 000 and then multiplying it by the crimes percapi... | github_jupyter |
```
#default_exp core
```
# fastdot.core
> Drawing graphs with graphviz.
```
#export
from fastcore.all import *
import pydot
from matplotlib.colors import rgb2hex, hex2color
#export
_all_ = ['pydot']
#hide
from nbdev.showdoc import *
```
## Nodes
```
#export
def Dot(defaults=None, rankdir='LR', directed=True, comp... | github_jupyter |
# Data Science Boot Camp
## Introduction to Pandas Part 1
* __Pandas__ is a Python package providing fast, flexible, and expressive data structures designed to work with *relational* or *labeled* data both.<br>
<br>
* It is a fundamental high-level building block for doing practical, real world data analysis in Pytho... | github_jupyter |
```
import pandas as pd
import numpy as np
import IPython.display as dsp
from pyqstrat.pq_utils import zero_to_nan, get_empty_np_value, infer_frequency, resample_trade_bars, has_display, strtup2date
from pyqstrat.plot import TradeBarSeries, TimeSeries, Subplot, Plot
from typing import Optional, Sequence, Tuple, Union,... | github_jupyter |
```
import os, json, sys, time, random
import numpy as np
import torch
from easydict import EasyDict
from math import floor
from easydict import EasyDict
from steves_utils.vanilla_train_eval_test_jig import Vanilla_Train_Eval_Test_Jig
from steves_utils.torch_utils import get_dataset_metrics, independent_accuracy_as... | github_jupyter |
\# Developer: Ali Hashaam (ali.hashaam@initos.com) <br>
\# 5th March 2019 <br>
\# © 2019 initOS GmbH <br>
\# License MIT <br>
\# Library for TSVM and SelfLearning taken from https://github.com/tmadl/semisup-learn <br>
\# Library for lagrangean-S3VM taken from https://github.com/fbagattini/lagrangean-s3vm <br>
```
fr... | github_jupyter |
<a href="https://colab.research.google.com/github/lauraAriasFdez/Ciphers/blob/master/project_tfif.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
### 1. Connect To Google Drive + Get Data
```
# MAIN DIRECTORY STILL TO DO
from google.colab import d... | github_jupyter |
# Chainer MNIST Model Deployment
* Wrap a Chainer MNIST python model for use as a prediction microservice in seldon-core
* Run locally on Docker to test
* Deploy on seldon-core running on minikube
## Dependencies
* [Helm](https://github.com/kubernetes/helm)
* [Minikube](https://github.com/kubernetes/miniku... | github_jupyter |
```
# coding=utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.utils import np_utils
from keras.models import Sequential,load_model,save_model
from keras.layers import Dense, Dropout, Activation,LeakyReLU
from keras.optimizers import SGD, Adam
from keras.callbacks import EarlyStopp... | github_jupyter |
```
import torch
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
from statsmodels.discrete.discrete_model import Probit
import patsy
import matplotlib.pylab as plt
import tqdm
import itertools
ax = np.newaxis
```
Make sure you have installed the pygfe package. You can simply call `pip instal... | github_jupyter |
# GDP and life expectancy
Richer countries can afford to invest more on healthcare, on work and road safety, and other measures that reduce mortality. On the other hand, richer countries may have less healthy lifestyles. Is there any relation between the wealth of a country and the life expectancy of its inhabitants?
... | github_jupyter |
# Immune disease associations of Neanderthal-introgressed SNPs
This code investigates if Neanderthal-introgressed SNPs (present in Chen introgressed sequences) have been associated with any immune-related diseases, including infectious diseases, allergic diseases, autoimmune diseases and autoinflammatory diseases, usi... | github_jupyter |
# American Gut Project example
This notebook was created from a question we recieved from a user of MGnify.
The question was:
```
I am attempting to retrieve some of the MGnify results from samples that are part of the American Gut Project based on sample location.
However latitude and longitude do not appear to be... | github_jupyter |
# Employee Attrition Prediction
There is a class of problems that predict that some event happens after N years. Examples are employee attrition, hard drive failure, life expectancy, etc.
Usually these kind of problems are considered simple problems and are the models have vairous degree of performance. Usually it is... | github_jupyter |
```
# Configuration --- Change to your setup and preferences!
CAFFE_ROOT = "~/caffe2"
# What image do you want to test? Can be local or URL.
# IMAGE_LOCATION = "images/cat.jpg"
# IMAGE_LOCATION = "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Whole-Lemon.jpg/1235px-Whole-Lemon.jpg"
# IMAGE_LOCATION = "http... | github_jupyter |
# Training a Boltzmann Generator for Alanine Dipeptide
This notebook introduces basic concepts behind `bgflow`.
It shows how to build an train a Boltzmann generator for a small peptide. The most important aspects it will cover are
- retrieval of molecular training data
- defining a internal coordinate transform
- d... | github_jupyter |
# LassoLars Regression with Robust Scaler
This Code template is for the regression analysis using a simple LassoLars Regression. It is a lasso model implemented using the LARS algorithm and feature scaling using Robust Scaler in a Pipeline
### Required Packages
```
import warnings
import numpy as np
import pandas... | github_jupyter |
```
import pandas as pd
import numpy as np
import xgboost as xgb
from sklearn.metrics import mean_absolute_error as mae
from sklearn.model_selection import cross_val_score
from hyperopt import hp, fmin, tpe, STATUS_OK
import eli5
from eli5.sklearn import PermutationImportance
```
## Wczytanie danych
```
df = pd.r... | github_jupyter |
# SLAM算法介绍
## 1. 名词解释:
### 1.1 什么是SLAM?
SLAM,即Simultaneous localization and mapping,中文可译作“同时定位与地图构建”。它描述的是这样一类过程:机器人在陌生环境中运动,通过处理各类传感器收集的机器人自身及环境信息,精确地获取对机器人自身位置的估计(即“定位”),再通过机器人自身位置确定周围环境特征的位置(即“建图”)
在SLAM过程中,机器人不断地在收集各类传感器信息,如激光雷达的点云、相机的图像、imu的信息、里程计的信息等,通过对这些不断变化的传感器的一系列分析计算,机器人会实时地得出自身行进的轨迹(比如一系列时刻的位姿),但得到的轨迹往往... | github_jupyter |
```
from fknn import *
import numpy as np
import pandas as pd
dataset = pd.read_csv("iris-virginica.csv")
dataset = dataset.sample(frac=1)
dataset
X = dataset.iloc[:, 1:3].values
Y = dataset.iloc[:,0].values
from sklearn.model_selection import train_test_split
xTrain, xTest, yTrain, yTest = train_test_split(X,Y)
from s... | github_jupyter |
```
import tensorflow as tf
import numpy as np
rng = np.random
import matplotlib.pyplot as plt
learning_rate = 0.0001
training_epochs = 1000
display_step = 50
with tf.name_scope("Creation_of_array"):
x_array=np.asarray([2.0,9.4,3.32,0.88,-2.23,1.11,0.57,-2.25,-3.31,6.45])
y_array=np.asarray([1.22,0.34,-0.08,2.... | github_jupyter |
```
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import gc
plt.style.use('ggplot')
dtypes = {
'ip' : 'uint32',
'app' : 'uint16',
'device' : 'uint16',
'os' : 'uint16',
'channel' : 'uint1... | github_jupyter |
```
# likely the simplest possible version?
# import turtle as t
# def sier(n,length):
# if (n==0):
# return
# for i in range(3):
# sier(n-1, length/2)
# t.fd(length)
# t.rt(120)
#!/usr/bin/env python
###############################################################################... | github_jupyter |
## Analyze A/B Test Results
You may either submit your notebook through the workspace here, or you may work from your local machine and submit through the next page. Either way assure that your code passes the project [RUBRIC](https://review.udacity.com/#!/projects/37e27304-ad47-4eb0-a1ab-8c12f60e43d0/rubric). **Ple... | github_jupyter |
# 2章 微分積分
## 2.1 関数
```
# 必要ライブラリの宣言
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
# PDF出力用
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')
def f(x):
return x**2 +1
f(1)
f(2)
```
### 図2-2 点(x, f(x))のプロットとy=f(x)のグラフ
```
x = np.linspace(-3, 3, 601)
y... | github_jupyter |
```
import random
class Coin:
def __init__(self, rare = False, clean = True, heads = True, **kwargs):
for key,value in kwargs.items():
setattr(self,key,value)
self.is_rare = rare
self.is_clean = clean
self.heads = heads
if self.is_rare:
se... | github_jupyter |
# VacationPy
----
#### Note
* Keep an eye on your API usage. Use https://developers.google.com/maps/reporting/gmp-reporting as reference for how to monitor your usage and billing.
* Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think throug... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
from matplotlib.patches import Polygon
from matplotlib.colorbar import ColorbarBase
%config InlineBackend.figure_format = 'retina'
```
To install basemap
`conda inst... | github_jupyter |
## 1. Meet Dr. Ignaz Semmelweis
<p><img style="float: left;margin:5px 20px 5px 1px" src="https://assets.datacamp.com/production/project_20/img/ignaz_semmelweis_1860.jpeg"></p>
<!--
<img style="float: left;margin:5px 20px 5px 1px" src="https://assets.datacamp.com/production/project_20/datasets/ignaz_semmelweis_1860.jpeg... | github_jupyter |
```
import os
from glob import glob
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
```
## Cleaning Up (& Stats About It)
- For each annotator:
- How many annotation files?
- How many txt files?
- Number of empty .ann files
- How many non-empty .ann files have a `Transcriptio... | github_jupyter |
# Lambda School Data Science - Loading, Cleaning and Visualizing Data
Objectives for today:
- Load data from multiple sources into a Python notebook
- From a URL (github or otherwise)
- CSV upload method
- !wget method
- "Clean" a dataset using common Python libraries
- Removing NaN values "Data Imputation"
- Cre... | github_jupyter |
# Sci-Fi IRL #1: Technology Terminology Velocity
### A Data Storytelling Project by Tobias Reaper
### ---- Datalogue 008 ----
---
---
### Imports and Configuration
```
# Three Musketeers
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
# For using the API
import reque... | github_jupyter |
# ORF recognition by CNN
Compare to ORF_CNN_101.
Use 2-layer CNN.
Run on Mac.
```
PC_SEQUENCES=20000 # how many protein-coding sequences
NC_SEQUENCES=20000 # how many non-coding sequences
PC_TESTS=1000
NC_TESTS=1000
BASES=1000 # how long is each sequence
ALPHABET=4 # how many different letters ... | github_jupyter |
```
"""
You can run either this notebook locally (if you have all the dependencies and a GPU) or on Google Colab.
Instructions for setting up Colab are as follows:
1. Open a new Python 3 notebook.
2. Import this notebook from GitHub (File -> Upload Notebook -> "GITHUB" tab -> copy/paste GitHub URL)
3. Connect to an in... | github_jupyter |
```
import pandas as pd
import numpy as np
#upload the csv file or
#!git clone
#and locate the csv and change location
df=pd.read_csv("/content/T1.csv", engine='python')
df.head()
lst=df["Wind Speed (m/s)"]
lst
max(lst)
min(lst)
lst=list(df["Wind Speed (m/s)"])
# Python program to get average of a list
def Average(... | github_jupyter |
```
from sklearn.datasets import load_iris
iris_dataset = load_iris()
'''
This is an example of a classifi cation problem. The possi‐
ble outputs (different species of irises) are called classes. Every iris in the dataset
belongs to one of three classes, so this problem is a three-class classification pro... | github_jupyter |
# Fundus Analysis - Pathological Myopia
```
!nvidia-smi
```
**Import Data from Google Drive**
```
from google.colab import drive
drive.mount('/content/gdrive')
import os
os.environ['KAGGLE_CONFIG_DIR'] = "/content/gdrive/My Drive/Kaggle"
%cd /content/gdrive/My Drive/Kaggle
pwd
```
**Download Data in Colab**
```
... | github_jupyter |
```
from dask_gateway import Gateway
import os
# External IPs
gateway = Gateway(
"http://ad7f4b0a2492a11eabd750e8c5de8801-1750344606.us-west-2.elb.amazonaws.com",
proxy_address="tls://ad7f57e7d492a11eabd750e8c5de8801-778017149.us-west-2.elb.amazonaws.com:8786",
auth='jupyterhub'
)
# Internal IPs
gateway = G... | github_jupyter |
```
%matplotlib inline
import matplotlib.pyplot as plt
import sys,os
sys.path.insert(0,'../')
from ml_tools.descriptors import RawSoapInternal
from ml_tools.models.KRR import KRR,TrainerCholesky,KRRFastCV
from ml_tools.kernels import KernelPower,KernelSum
from ml_tools.utils import get_mae,get_rmse,get_sup,get_spearman... | github_jupyter |
```
import csv
from numpy import genfromtxt
import numpy as np
import pandas as pd
from random import random
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import math
import sklearn.linear_model
# Function to check and remove NaNs from dataset
def dataChecker(arr):
idxRow = -1
... | github_jupyter |
# How to detect breast cancer with a Support Vector Machine (SVM) and k-nearest neighbours clustering and compare results.
Load some packages
```
import scipy
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sklearn
from sklearn import preprocessing
from sklearn.model_selection ... | github_jupyter |
<a href="https://colab.research.google.com/github/timeseriesAI/tsai/blob/master/tutorial_nbs/02_ROCKET_a_new_SOTA_classifier.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
created by Ignacio Oguiza - email: timeseriesAI@gmail.com
<img src="https:/... | github_jupyter |
# Brownian process in stock price dynamics
Brownian Moton:

source: https://en.wikipedia.org/wiki/Brownian_motion

A **random-walk** can be seen as a **motion** resulting from a succession of discrete **random steps**.
The random... | github_jupyter |
# City street network orientations
Compare the spatial orientations of city street networks with OSMnx.
- [Overview of OSMnx](http://geoffboeing.com/2016/11/osmnx-python-street-networks/)
- [GitHub repo](https://github.com/gboeing/osmnx)
- [Examples, demos, tutorials](https://github.com/gboeing/osmnx-examples)
... | github_jupyter |
# Modelado de Robots
Recordando la práctica anterior, tenemos que la ecuación diferencial que caracteriza a un sistema masa-resorte-amoritguador es:
$$
m \ddot{x} + c \dot{x} + k x = F
$$
y revisamos 3 maneras de obtener el comportamiento de ese sistema, sin embargo nos interesa saber el comportamiento de un sistema... | github_jupyter |
```
import pandas as pd
from lifelines import KaplanMeierFitter
import seaborn as sns
import matplotlib.pyplot as plt
preprints_df = pd.read_csv("output/biorxiv_article_metadata.tsv", sep="\t",)
preprints_df["date_received"] = pd.to_datetime(preprints_df["date_received"])
xml_df = (
preprints_df.sort_values(by="dat... | github_jupyter |
```
import calour as ca
import calour_utils as cu
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import glob
import os
import pandas as pd
import shutil
ca.set_log_level('INFO')
%matplotlib inline
pwd
```
# Load the data
### Without the known blooming bacteria (from American Gut paper)
``... | github_jupyter |
# Use BlackJAX with Numpyro
BlackJAX can take any log-probability function as long as it is compatible with JAX's JIT. In this notebook we show how we can use Numpyro as a modeling language and BlackJAX as an inference library.
We reproduce the Eight Schools example from the [Numpyro documentation](https://github.com... | github_jupyter |
## Exercicis del Tema 4
### Subprogrames
Es recomanable fer tots els exercicis en el mateix fitxer Python. Un cop heu realitzat la funció o subprograma
corresponent heu de comprovar el seu correcte funcionament.
1.Subprograma que rep dos enters, els suma i retorna el resultat.
2.Procediment que rep dos enters, els ... | github_jupyter |
The visualization used for this homework is based on Alexandr Verinov's code.
# Generative models
In this homework we will try several criterions for learning an implicit model. Almost everything is written for you, and you only need to implement the objective for the game and play around with the model.
**0)** Rea... | github_jupyter |
# 1. Import libraries
```
#----------------------------Reproducible----------------------------------------------------------------------------------------
import numpy as np
import tensorflow as tf
import random as rn
import os
seed=0
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
rn.seed(seed)
#sess... | github_jupyter |
# Deprecated - Connecting Brain region through BAMS information
This script connects brain regions through BAMS conenctivity informtation.
However, at this level the connectivity information has no reference to the original, and that is not ok. Thereby do **not** use this.
```
### DEPRECATED
import pandas as pd
impo... | github_jupyter |
```
import requests as r
url = 'https://api.covid19api.com/dayone/country/brazil'
resp = r.get(url)
resp.status_code
raw_data = resp.json()
raw_data[0]
final_data = []
for data in raw_data:
final_data.append([data['Confirmed'], data['Deaths'], data['Recovered'], data['Active'], data['Date']])
final_data.insert(0,... | github_jupyter |
# Tile Coding
---
Tile coding is an innovative way of discretizing a continuous space that enables better generalization compared to a single grid-based approach. The fundamental idea is to create several overlapping grids or _tilings_; then for any given sample value, you need only check which tiles it lies in. You c... | github_jupyter |
```
import h5py
import numpy as np
files = ['../Data/ModelNet40_train/ply_data_train0.h5',
'../Data/ModelNet40_train/ply_data_train1.h5',
'../Data/ModelNet40_train/ply_data_train2.h5',
'../Data/ModelNet40_train/ply_data_train3.h5',
'../Data/ModelNet40_train/ply_data_train4.h5']
#fil... | github_jupyter |
# Sorting
### 1. Bubble: $O(n^2)$
repeatedly swapping the adjacent elements if they are in wrong order
### 2. Selection: $O(n^2)$
find largest number and place it in the correct order
### 3. Insertion: $O(n^2)$
### 4. Shell: $O(n^2)$
### 5. Merge: $O(n \log n)$
### 6. Quick: $O(n \log n)$
it is important to select prop... | github_jupyter |
# Physically labeled data: pyfocs single-ended examples
Finally, after all of that (probably confusing) work we can map the data to physical coordinates.
```
import xarray as xr
import pyfocs
import os
```
# 1. Load data
## 1.1 Configuration files
As in the previous example we will load and prepare the configurati... | github_jupyter |
# Machine Translation English-German Example Using SageMaker Seq2Seq
1. [Introduction](#Introduction)
2. [Setup](#Setup)
3. [Download dataset and preprocess](#Download-dataset-and-preprocess)
3. [Training the Machine Translation model](#Training-the-Machine-Translation-model)
4. [Inference](#Inference)
## Introductio... | github_jupyter |
<a href="https://colab.research.google.com/github/eunyul24/eunyul24.github.io/blob/master/B_DS2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
from google.colab import drive
drive.mount('/content/drive')
import numpy as np
import csv
```
```... | github_jupyter |
# 911 Calls Capstone Project - Solutions
For this capstone project we will be analyzing some 911 call data from [Kaggle](https://www.kaggle.com/mchirico/montcoalert). The data contains the following fields:
* lat : String variable, Latitude
* lng: String variable, Longitude
* desc: String variable, Description of the... | github_jupyter |
# Let's Grow your Own Inner Core!
### Choose a model in the list:
- geodyn_trg.TranslationGrowthRotation()
- geodyn_static.Hemispheres()
### Choose a proxy type:
- age
- position
- phi
- theta
- growth rate
### set the parameters for the model : geodynModel.set_parameters(parameters)
###... | github_jupyter |
<a href="https://colab.research.google.com/github/danzerzine/seospider-colab/blob/main/Running_screamingfrog_SEO_spider_in_Colab_notebook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Запуск SEO бота Screaming Frog SEO spider в облаке через Goog... | github_jupyter |
----
### 베이즈 정리
- 데이터라는 조건이 주어졌을 때 조건부 확률을 구하는 공식
- $P(A|B) = \frac{P(B|A)P(A)}{P(B)}$
----
- $P(A|B)$ : 사후확률(posterior). 사건 B가 발생한 후 갱신된 사건 A의 확률
- $P(A)$ : 사전확률 (prior). 사건 B가 발생하기 전에 가지고 있던 사건 A의 확률
- $P(B|A)$ : 가능도(likelihood). 사건 A가 발생한 경우 사건 B의 확률
- $P(B)$ : 정규화상수(normalizing constant) 또는 증거... | github_jupyter |
# Machine Learning
## Overview
Machine learning is the ability of computers to take a dataset of objects and learn patterns about them. This dataset is structured as a table, where each row is a vector representing some object by encoding their properties as the values of the vector. The columns represent **features*... | github_jupyter |
## _*Using Qiskit Aqua for clique problems*_
This Qiskit Aqua Optimization notebook demonstrates how to use the VQE quantum algorithm to compute the clique of a given graph.
The problem is defined as follows. A clique in a graph $G$ is a complete subgraph of $G$. That is, it is a subset $K$ of the vertices such that... | github_jupyter |
# Test shifting template experiments
```
%load_ext autoreload
%autoreload 2
import os
import sys
import pandas as pd
import numpy as np
import random
import umap
import glob
import pickle
import tensorflow as tf
from keras.models import load_model
from sklearn.decomposition import PCA
from plotnine import (ggplot,
... | github_jupyter |
# 选择
## 布尔类型、数值和表达式

- 注意:比较运算符的相等是两个等到,一个等到代表赋值
- 在Python中可以用整型0来代表False,其他数字来代表True
- 后面还会讲到 is 在判断语句中的用发
```
1== true
while 1:
print('hahaha')
```
## 字符串的比较使用ASCII值
```
'a'>True
0<10>100
num=eval(input('>>'))
if num>=90:
print('A')
elif 80<=num<90:
print('B')
else :
print('C')
... | github_jupyter |
<img src="../../../../../images/qiskit_header.png" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" align="middle">
# _*Qiskit Finance: Option Pricing*_
The latest version of this notebook is available on https://github.com/Qiskit/qiskit-tutorials.
***
... | github_jupyter |
```
# Synapse Classification Challenge
# Introduction to Connectomics 2017
# Darius Irani
your_name = 'irani_darius'
!pip install mahotas
!pip install ndparse
%matplotlib inline
# Load data
import numpy as np
import tensorflow as tf
data = np.load('./synchallenge2017_training.npz')
imtrain = data['imtrain']
annotr... | github_jupyter |
```
# Загрузка зависимостей
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
#Часто используемые функции
def hist_show(a, b = 50):
plt.hist(a, bins = b)
plt.show()
def replace_zero_to_... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
```
# 1. Деревья решений для классификации (продолжение)
На прошлом занятии мы разобрали идею Деревьев решений:

Давайте теперь разберемся **как происходит разделения в каждом узле** то есть как проходит этап **об... | github_jupyter |
```
# Boilerplate that all notebooks reuse:
from analysis_common import *
%matplotlib inline
```
# Kernel analysis
```
df = read_ods("./results.ods", "matmul-kernel")
expand_modes(df)
print(df["MODE"].unique())
#############################################
# Disregard the store result for the kernel #
############... | github_jupyter |
```
import re
import numpy as np
import pandas as pd
import collections
from sklearn import metrics
from sklearn.preprocessing import LabelEncoder
import tensorflow as tf
from sklearn.model_selection import train_test_split
from unidecode import unidecode
from tqdm import tqdm
import time
rules_normalizer = {
'expe... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.