machine-learning

Difference between two dates in Pandas DataFrame

℡╲_俬逩灬. 提交于 2021-02-11 07:10:57
问题 I have many columns in a data frame and I have to find the difference of time in two column named as in_time and out_time and put it in the new column in the same data frame. The format of time is like this 2015-09-25T01:45:34.372Z . I am using Pandas DataFrame. I want to do like this: df.days = df.out_time - df.in_time I have many columns and I have to increase 1 more column in it named days and put the differences there. 回答1: You need to convert the strings to datetime dtype, you can then

Difference between two dates in Pandas DataFrame

空扰寡人 提交于 2021-02-11 07:09:59
问题 I have many columns in a data frame and I have to find the difference of time in two column named as in_time and out_time and put it in the new column in the same data frame. The format of time is like this 2015-09-25T01:45:34.372Z . I am using Pandas DataFrame. I want to do like this: df.days = df.out_time - df.in_time I have many columns and I have to increase 1 more column in it named days and put the differences there. 回答1: You need to convert the strings to datetime dtype, you can then

Difference between two dates in Pandas DataFrame

情到浓时终转凉″ 提交于 2021-02-11 07:09:18
问题 I have many columns in a data frame and I have to find the difference of time in two column named as in_time and out_time and put it in the new column in the same data frame. The format of time is like this 2015-09-25T01:45:34.372Z . I am using Pandas DataFrame. I want to do like this: df.days = df.out_time - df.in_time I have many columns and I have to increase 1 more column in it named days and put the differences there. 回答1: You need to convert the strings to datetime dtype, you can then

Difference between two dates in Pandas DataFrame

喜夏-厌秋 提交于 2021-02-11 07:07:38
问题 I have many columns in a data frame and I have to find the difference of time in two column named as in_time and out_time and put it in the new column in the same data frame. The format of time is like this 2015-09-25T01:45:34.372Z . I am using Pandas DataFrame. I want to do like this: df.days = df.out_time - df.in_time I have many columns and I have to increase 1 more column in it named days and put the differences there. 回答1: You need to convert the strings to datetime dtype, you can then

Pytorch nn Module generalization

不问归期 提交于 2021-02-11 06:20:37
问题 Let us take a look at the simple class: class Temp1(nn.Module): def __init__(self, stateSize, actionSize, layers=[10, 5], activations=[F.tanh, F.tanh] ): super(Temp1, self).__init__() self.layer1 = nn.Linear(stateSize, layers[0]) self.layer2 = nn.Linear(layers[0], layers[1]) self.fcFinal = nn.Linear( layers[1], actionSize ) return This is a fairly straight forward pytorch module. It creates a simple sequential dense network. If we check its hidden parameters, we see the following: t1 = Temp1

Pytorch nn Module generalization

∥☆過路亽.° 提交于 2021-02-11 06:20:18
问题 Let us take a look at the simple class: class Temp1(nn.Module): def __init__(self, stateSize, actionSize, layers=[10, 5], activations=[F.tanh, F.tanh] ): super(Temp1, self).__init__() self.layer1 = nn.Linear(stateSize, layers[0]) self.layer2 = nn.Linear(layers[0], layers[1]) self.fcFinal = nn.Linear( layers[1], actionSize ) return This is a fairly straight forward pytorch module. It creates a simple sequential dense network. If we check its hidden parameters, we see the following: t1 = Temp1

SVM-OVO vs SVM-OVA in a very basic example

泄露秘密 提交于 2021-02-10 22:42:17
问题 Trying to understand how SVM-OVR (One-Vs-Rest) works, I was testing the following code: import matplotlib.pyplot as plt import numpy as np from sklearn.svm import SVC x = np.array([[1,1.1],[1,2],[2,1]]) y = np.array([0,100,250]) classifier = SVC(kernel='linear', decision_function_shape='ovr') classifier.fit(x,y) print(classifier.predict([[1,2]])) print(classifier.decision_function([[1,2]])) The outputs are: [100] [[ 1.05322128 2.1947332 -0.20488118]] It means that the sample [1,2] is

SVM-OVO vs SVM-OVA in a very basic example

♀尐吖头ヾ 提交于 2021-02-10 22:40:11
问题 Trying to understand how SVM-OVR (One-Vs-Rest) works, I was testing the following code: import matplotlib.pyplot as plt import numpy as np from sklearn.svm import SVC x = np.array([[1,1.1],[1,2],[2,1]]) y = np.array([0,100,250]) classifier = SVC(kernel='linear', decision_function_shape='ovr') classifier.fit(x,y) print(classifier.predict([[1,2]])) print(classifier.decision_function([[1,2]])) The outputs are: [100] [[ 1.05322128 2.1947332 -0.20488118]] It means that the sample [1,2] is

Fine Tuning hyperparameters doesn't improve score of classifiers

十年热恋 提交于 2021-02-10 18:30:31
问题 I am experiencing a problem where finetuning the hyperparameters using GridSearchCV doesn't really improve my classifiers. I figured the improvement should be bigger than that. The biggest improvement for a classifier I've gotten with my current code is around +-0.03. I have a dataset with eight columns and an unbalanced binary outcome. For scoring I use f1 and I use KFold with 10 splits. I was hoping if someone could spot something which is off and I should look at? Thank you! I use the

Keras' fit_generator() for binary classification predictions always 50%

落花浮王杯 提交于 2021-02-10 17:30:00
问题 I have set up a model to train on classifying whether an image is a certain video game or not. I pre-scaled my images into 250x250 pixels and have them separated into two folders (the two binary classes) labelled 0 and 1 . The amount of both classes are within ~100 of each other and I have around 3500 images in total. Here are photos of the training process, the model set up and some predictions: https://imgur.com/a/CN1b6LV train_datagen = ImageDataGenerator( rescale=1. / 255, shear_range=0,