This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch.nn.functional as F | |
| from pytorch_lightning import seed_everything, LightningModule, Trainer | |
| from pytorch_lightning.callbacks import EarlyStopping | |
| from torch import nn, optim, rand, sum as tsum, reshape, save | |
| from torch.utils.data import DataLoader, Dataset | |
| SAMPLE_DIM = 21000 | |
| class CustomDataset(Dataset): | |
| def __init__(self, samples=42): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| from pathlib import Path | |
| #define parameters | |
| #path to files | |
| path_old=Path(r'C:\Users\owner\Documents\old.xlsx') | |
| path_new=Path(r'C:\Users\owner\Documents\new.xlsx') | |
| #list of key column(s) | |
| key=['id'] | |
| #sheets to read in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Load required Keras libraries: | |
| from keras.preprocessing.sequence import pad_sequences | |
| from keras.models import Model | |
| from keras.layers import Input, Embedding, LSTM, Merge | |
| import keras.backend as K | |
| from keras.optimizers import Adadelta | |
| from keras.callbacks import ModelCheckpoint | |
| I wrote a routine to clean text data | |
| def text_to_word_list(text): | |
| ''' Pre process and convert texts to a list of words ''' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| u""" | |
| Beta regression for modeling rates and proportions. | |
| References | |
| ---------- | |
| Grün, Bettina, Ioannis Kosmidis, and Achim Zeileis. Extended beta regression | |
| in R: Shaken, stirred, mixed, and partitioned. No. 2011-22. Working Papers in | |
| Economics and Statistics, 2011. |