This file contains 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 re | |
class ElasticsearchHelpers(object): | |
""" | |
Sanitize a query string for Elasticsearch / Lucene. | |
Based on: | |
http://stackoverflow.com/questions/16205341/symbols-in-query-string-for-elasticsearch | |
https://gist.github.com/bcoe/6505434 |
This file contains 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 | |
import random | |
import torch.nn as nn | |
from torch.optim import Adam | |
import pytorch_lightning as pl | |
from torch.utils.data import Dataset, DataLoader | |
class SampleDataset(Dataset): | |
def __init__(self, size, coef_1, coef_2): | |
self.size = size |
This file contains 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 | |
import torch.nn as nn | |
from torch.optim import Adam | |
from torch.utils.data import Dataset, DataLoader | |
class SampleDataset(Dataset): | |
def __init__(self, size, coef_1, coef_2): | |
self.size = size | |
self.coef_1 = coef_1 | |
self.coef_2 = coef_2 |
This file contains 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
out = parallel(delayed(_fit_and_score)(clone(base_estimator), | |
X, y, | |
train=train, test=test, | |
parameters=parameters, | |
**fit_and_score_kwargs) | |
for parameters, (train, test) | |
in product(candidate_params, | |
cv.split(X, y, groups))) |