# Tag Info

## Hot answers tagged python

2

This is well explained on the original paper Section 3. As well as in the Supervised Random Forest, Isolation Forest makes use of sampling on both, features and instances, so the latter in this case helps alleviate 2 main problems: Swamping Swamping refers to wrongly identifying normal instances as anomalies. When normal instances are too close to ...

1

That part of the code will select the samples that belong to a specific batch. The for loop first loops over the data in train_X in steps of BATCH_SIZE, which means that the variable i holds the first index for each batch in the training dataset. The rest of the samples for the batch are then the ones after that index up to the sample which completes the ...

1

Since you specifically mention Python, one option is the Prophet package. The model fitting would be something like: # Create the pandas DataFrame import pandas as pd data = [['2021-01-01', 11, 20, 30], ['2021-01-02', 22, 40, 60], ['2021-01-03', 33, 60, 90]] df = pd.DataFrame(data, columns = ['Day', 'X', 'Y', 'Z']) df['ds'] = pd.to_datetime(...

1

You should read this post. It's a long one but it's a useful one. It relies on LSTM for time series forecasting and does a very good job of illustrating how framing the problem, ie: how to you define what's the training and the target data, influence what the model is going to predict. In your case, it's gonna show that you only need using you n-1 Var ...

1

In essence, you want to both incorporate the past historical values of the target timeseries and the (past and) current historical values of other timeseries to predict the current value of the target timeseries. In the tutorial you gave, they define the VAR[1] model with two time series ($Y_{1, t}$, $Y_{2, t}$) as:  Y_{1,t} = \alpha_{1} + \beta_{11,1}Y_{1,...

1

torch.argmax has an extra argument dim which you can specify such that the maximum value is taken over a specific dimension. If you specify the dimension which represents the number of images it will return an array of indices where each value is for one image. For example: import torch # 3 images with 5 classes t = torch.randn(3, 5) # tensor([[-1.2917, 1....

1

A rate is always a gain per some time/step. A rate can exist even if the maximum is never reached. In supervised learning a loss function is defined, which is expected to have a global maximum, that we try to reach by gradient descent. How much closer we get with each timestep/iteration/epoch/batch is the rate of convergence.

1

There are no combinations that work for all cases, hyperparameter tuning is still something that is mostly done by trial and error. Things like Gridsearch and Randomsearch exist though. A good start is always the default setting. An idea if performance is an issue is to tune on a small percentage of the training set to later switch to the full set.

1

Following the suggestion given by @Ubikuity, I changed the ax.plot to ax.scatter, but there were still some issues with the dimensions. It was due to the transposition of the matrices, that was being done in the wrong place. The code below works correctly. X = df[["Idade","LF"]] y = df["DGAF"].values.reshape(len(df["DGAF&...

1

I managed to make it work, by combining the city column with the venue categories column into a 2D (numpy) array which can be used by the RandomForestClassifier of sklearn. Example code: import pandas as pd from sklearn.preprocessing import LabelEncoder from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split ...

1

You can start with rule-based methods, such as a combination of regular expression and if/then statements.

1

I think the shortest answer can be this slide from Jake Vanderplas' PyCon 2017 Keynote (and it's a great talk which can be a longer answer): Thus most people don't prefer Pandas per se, they prefer (rapidly growing) Python Data Stack and Python ecosystem encompassing it. Scientist may go mostly with high-level domain packages, data engineers with ML ...

Only top voted, non community-wiki answers of a minimum length are eligible