A Kareem
  • Member for 1 year, 9 months
  • Last seen more than a week ago
difference in l1 and l2 regularization
Accepted answer
8 votes

That is generally not true, to be more accurate we can say that L1 promotes sparsity. if a weight is larger than 1 then L2 cares more about it than L1 while if a weight is less than 1 then L1 cares ...

View answer
Balanced Accuracy vs. F1 Score
Accepted answer
7 votes

One major difference is that the F1-score does not care at all about how many negative examples you classified or how many negative examples are in the dataset at all; instead, the balanced accuracy ...

View answer
How much features are needed for Reinforcement learning?
6 votes

It really depends on how much data (samples) you have instead of how many features each samples has. And more importantly it depends on how you plan to structure the problem into an Environment with ...

View answer
Norm type in cost function of ANN
Accepted answer
2 votes

Reading the article they state that The two vertical lines represent the $L^2$ norm of the error, or what is known as the sum-of-squares error (SSE) Otherwise known as the Euclidean norm, ...

View answer
plotting a decision tree based on gridsearchcv
Accepted answer
2 votes

While I don't have a module named graphviz I can still try to help. Reading the documentation for GridSearchCV, I can see that there's a attribute called best_estimator_ that provides the estimator ...

View answer
Negative value in information gain calculation through gini index
Accepted answer
2 votes

I quickly checked your calculation and you seem to have miscalculated the gini(annual income) gini(annual income)=1-((5/20)^2+(12/20)^2+(3/20)^2) = 0.445 When it actually equals 0.555 (you ...

View answer
Sort dataframe by date column stored as string
Accepted answer
2 votes

I suggest first separating the month column into day and month using str.split('-') # create test data df = pd.DataFrame(['20-Apr', '19-Mar', '4-Dec'], columns=['month']) # create day column df['day']...

View answer
Why is the input to an activation function a linear combination of the input features?
Accepted answer
2 votes

The main reason is that a linear combination of the input followed by a non-linearity stacked on top of eachother is a universal function approximator. Which means that no matter how complicated the ...

View answer
How to seperate text lines from txt files in python?
1 votes

You can read the file line by line, discard blank lines, and wrap the lines that are left by a list to get the same as your desired result with open(file_name, 'r') as f: print([[x.strip()] for x ...

View answer
How to increase a low recall value?
1 votes

Your problem isn't just a low recall value, your problem is your model needs improving. A high accuracy with a highly unbalanced dataset means practically nothing since simply predicting the most ...

View answer
Is my model to big? I am trying to predict orders for a company, and I don't know if there are typical values for macroparameters
1 votes

Theoretically, a model should be big enough to have a low bias (avoid underfitting), but not too big as to have too high of a variance (avoid overfitting), called the bias-variance tradeoff Whether ...

View answer
How to train-test split and cross validate in Surprise?
Accepted answer
1 votes

EDIT: It seems I misunderstood the task at first, so here's my correction. Hope it works this time It seems like what you're trying to do is similar to what is in the documentation under examples/...

View answer
Convert json to dataframe in python
1 votes

Have you tried using the pandas.read_json method? (documentation) And it looks like your json is structured like 'records' so use pd.read_json(_, orient='records')

View answer
Subdivide a numerical vector with a normal distribution
1 votes

You seem to be describing the method cut in pandas (documentation) This method does exactly what you want, if you want to separate a dataframe into n equal-sized bins or manually specify the ranges. ...

View answer
What is the objective that is optimized with Random Search?
Accepted answer
1 votes

According to the documentation, the function RandomizedSearchCV accepts a scoring string that can take any value from this table and you can even implement your own custom scorer depending on what ...

View answer
Help improving my "read_excel" execution time in python. My code reads slowly
Accepted answer
1 votes

Well yes it would be slow because you are opening and closing the file for every iteration of the for loop. A general rule in programming is that if the file is not constantly changing, then only open ...

View answer
how to compute bernoulli entropy?
1 votes

Good observation, and yes, they are in fact equivalent ways of computing the entropy of a bernoulli random variable. To begin, you have to notice that in the openai code, we do not have the value of ...

View answer
Syntax error but nothing appears to be wrong?
0 votes

In the second line of the for loop create_grid.fit(X_train.fillna(X_train.mean(), y_train.fillna(y_train.mean())) You need an extra closing parenthesis like so create_grid.fit(X_train.fillna(...

View answer
Can I plug models like Linear Regression into a CNN feature map result?
Accepted answer
0 votes

What you're explaining is basically almost every CNN model where you basically have a fully connected layer at the end of the convolutions and that is equivalent to having a linear/logistic regression ...

View answer
Number of internal nodes in a Decision Tree
Accepted answer
0 votes

Building a decision tree is a process where the algorithm picks the first feature to split on $i_1$ from the set of features $n$ that it can split on $i_1={1,...,n}$. After splitting, the algorithm ...

View answer
Why transpose of independent feature matrix is necessary in case of linear regression?
0 votes

That answer comes from the set of weights $w$ (or $\theta$) that analytically solves the cost function which is defined to be $J(\theta) = (X\theta - y)^T (X\theta - y)$ (See here for more info) ...

View answer
Bar plot with varying length
Accepted answer
0 votes

I would first decide to bin the x-axis such that it can be plotted in groups. Thus if we want to for example group them into bins of width 5 then plot them next to each other we would do something ...

View answer
Test data for statistical t-test in Python
Accepted answer
0 votes

In Python, to generate random numbers from a certain distribution you would pick the corresponding distribution from np.random (documentation) and pass the corresponding parameters. Thus to draw from ...

View answer
Fitting a pandas dataframe to a Poisson Distribution
Accepted answer
0 votes

I think the cause of the error is the np.math.factorial(k) function call, since curve_fit passes a numpy array as the first parameter to the poisson function, and if you try to run the code np.math....

View answer
How to increase number of outliers in a dataset?
0 votes

I'm assuming you want to create a point that, each column by itself appears normal, but when looking at all the columns appears as if it's an outlier (thus you'd need some sort of outlier detection). ...

View answer
Tensor Mean of values greater than a threshold
0 votes

First, If you calculate the mean along dim=1 the output shape should be [a, c]. If you want to mask the mean that's less then a threshold and set it to zero you can do # generate data torch....

View answer
How to measure Covid impact by analysing credit card transaction of customer
0 votes

Do you have some sort of labeled data? Otherwise I'd hypothesize that this task is close to impossible since any sort of unsupervised algorithm using anomaly detection would likely have an ...

View answer
Trying to understand the result provided by np.linalg.norm function in numpy (normalisation)
Accepted answer
0 votes

The formula you cited is not the formula scipy is using. According to the documentation it calculates the "Frobenius norm" which is defined to be the root of the squared sum of the elements of each ...

View answer