Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loddi test
#1
creating this thread for students at loddi python school.

my_minmax_scaler = preprocessing.MinMaxScaler()
my_minmax_scaler.fit(X[:, :3])
my_minmax_scaler.transform(X[:, :3]).max(axis=0)
Reply
#2
Did you have a question?
Reply
#3
(Dec-13-2018, 11:01 PM)micseydel Wrote: Did you have a question?
hi, not yet, thx. created this thread for a school project.
Reply
#4
scores1 = []
for k in range (1, 10):
    kmeans = KMeans(n_clusters= k).fit(X2)
    score = kmeans.score(X2)
    scores1.append((k,score))
    
Reply
#5
part one of next week's homework:
#creating verified & non verified user df
df_unverified = df[df['verified']==False]
df_verified = df[df['verified']==True]

#creating verified & non verified user sentiment analyses
import seaborn as sns

df['sentiment'] = df_unverified['Text1'].apply(lambda tweet: TextBlob(tweet).sentiment.polarity)
df['sentiment']=df['sentiment'].astype('float')

positive = df[df['sentiment']>0].count().astype(int)
negative = df[df['sentiment']<0].count().astype(int)
neutral = df[df['sentiment']==0].count().astype(int)

labels= ['positive','neutral','negative']
sizes = [positive[0],neutral[0],negative[0]]
colors=['lightgreen','grey','orange']
patches, texts, poop = plt.pie(sizes, colors=colors, startangle=90, autopct='%1.0f%%')
plt.legend(patches, labels, loc="best")
plt.title("How unverified users are reacting on #brexit by analyzing " + str(positive[0]+negative[0]+neutral[0]) + " tweets.")
plt.axis('equal')
plt.show()
plt.savefig('sentiment_analysis_unverified_users')

df['sentiment'] = df_verified['Text1'].apply(lambda tweet: TextBlob(tweet).sentiment.polarity)
df['sentiment']=df['sentiment'].astype('float')

positive = df[df['sentiment']>0].count().astype(int)
negative = df[df['sentiment']<0].count().astype(int)
neutral = df[df['sentiment']==0].count().astype(int)

labels= ['positive','neutral','negative']
sizes = [positive[0],neutral[0],negative[0]]
colors=['lightgreen','grey','orange']
patches, texts, poop = plt.pie(sizes, colors=colors, startangle=90, autopct='%1.0f%%')
plt.legend(patches, labels, loc="best")
plt.title("How verified users are reacting on #brexit by analyzing " + str(positive[0]+negative[0]+neutral[0]) + " tweets.")
plt.axis('equal')
plt.show()
plt.savefig('sentiment_analysis_verified_users')
Reply
#6
from sklearn.cross_validation import train_test_split
from sklearn.datasets import load_loddi
from sklearn.metrics import classification_report, accuracy_score, confusion_matrix

X, y = load_loddi(return_X_y=True)
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.25,random_state=0)
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020