Skip to content

Commit e3c0010

Browse files
committed
setup for bloomberg
1 parent 8b63cbe commit e3c0010

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
2-
3-
41
import pandas as pd
52
import numpy as np
6-
from wandblog import log
73
import wandb
4+
85
run = wandb.init(job_type='eval')
96
config = run.config
7+
config.lowercase=True
8+
config.ngram_min=1
9+
config.ngram_max=1
1010

1111
df = pd.read_csv('tweets.csv')
1212
target = df['is_there_an_emotion_directed_at_a_brand_or_product']
@@ -18,15 +18,14 @@
1818
from sklearn.feature_extraction.text import CountVectorizer
1919
count_vect = CountVectorizer(lowercase=config.lowercase,
2020
ngram_range=(config.ngram_min,
21-
config.ngram_max),
22-
token_pattern=config.token_pattern
21+
config.ngram_max)
2322
)
2423
count_vect.fit(fixed_text)
2524

2625
counts = count_vect.transform(fixed_text)
2726

2827
from sklearn.naive_bayes import MultinomialNB
29-
nb = MultinomialNB(alpha=config.alpha)
28+
nb = MultinomialNB()
3029

3130
from sklearn.model_selection import cross_val_score, cross_val_predict
3231

@@ -35,4 +34,4 @@
3534
print(scores.mean())
3635

3736
predictions = cross_val_predict(nb, counts, fixed_target)
38-
log(run, fixed_text, fixed_target, predictions)
37+
wandb.log({"Accuracy": scores.mean()})

examples/scikit/wandb/settings

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[default]
2-
entity: qualcomm
3-
project: scikit-dec4
4-
base_url: https://api.wandb.ai
2+
entity = bloomberg-class
3+
project = text-sentiment
4+
base_url = https://api.wandb.ai
5+

0 commit comments

Comments
 (0)