I don't understand how L1 regularization is zeroing out the coefficients?

Active In

Competitive Programming

Machine Learning

Deep Astronomy

UI/UX Design

Stand-up Comedy

Artificial Intelligence

Fitness

Natural Language Processing

Technology

Algorithms and Data Structures

Featured Contributions

comment in this discussion

I don't understand how L1 regularization is zeroing out the coefficients?

Read more… (11 words)

comment in this discussion

If anyone needs the solution

# include <bits/stdc++.h>using namespace std;long long int ctr2 = 0;void dfs(int i, vector <int> e[], bool vis[]){// vis[i] = true;// ctr2++;for (int j = 0; j < e[i].size(); j++){int x = e[i][j];if (!vis[x]){vis[x] = true;ctr2++;dfs(x,e,vis);}}}int main(){int q;cin>>q;

Read more… (5 words)

comment in this discussion

Tried it using BFS. It's working

# include <bits/stdc++.h>using namespace std;int main(){int n;cin>>n;int a[n+10];int p[n+10];vector<int> e[n+10];int root;for (int i = 1; i <= n; i++){cin>>a[i];}for (int i = 1; i <= n; i++){cin>>p[i];if (p[i] == -1){root = i;continue;}e[p[i]].push_back(i);

Read more… (6 words)

comment in this discussion

Great article, Congrats

Can certainly see a follow up article or a part two, where you could discuss a few other models and also their applications(real life examples which are using these models). It may entice a lot of non- technical folks

Read more… (42 words)

comment in this discussion

Thanks I get it now, it's just an array of vectors (instead of char, int, float and other usual ones).

The error was because I was treating adjacency_list as a vector not array,so my storage declaration was wrong.

Now I get it, Thanks for the reply.

Read more… (46 words)

comment in this discussion

In the following line

vector <int> adjacency_list [NMAX];

wouldn't it just create a 1D vector of int data- type and so this statement will not be valid as this is 2D

adjacency_list[a].push_back(b);

I did try to implement the above one and it gave me error .

I think the type <int> will be a vector-type like

vector <int> v;vector <v> adjacency_list[NMAX];

Please correct me if I am wrong

Read more… (58 words)

comment in this discussion

I don't know if you solved it or not but for n = 1, shouldn't it return 1?This code returns 0 I guess.

Read more… (23 words)

comment in this discussion

I guess it depends on the size of N. If O(N^2) is viable , you could generate all the primes upto N in an array and then store the sum of every partition in a 2d array. This will give you every sum possible from those primes and you can just look for those which are equal to N

NOTE: This possibly won't work if N is of order 10^5 or higher.

We will have to come up with some other idea for that.

It will help if you could link the question as well :)

Read more… (96 words)

comment in this discussion

Since the IARCS online judge is not working, is there any way I could find these questions on some other sites?

Read more… (21 words)

comment in this discussion

Yeah it did fail in this case you gave.I figured out the problem.

Thank You for the suggestions

Read more… (18 words)