-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterviewquestions.html
147 lines (136 loc) · 10 KB
/
interviewquestions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title style="font-size: 18px;">Ridhima Garg</title>
<link rel="icon" href="img/fav1.png" type="image/x-icon">
<!----link href="https://fonts.googleapis.com/css?family=PT+Sans&display=swap" rel="stylesheet"-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous">
</script>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital@1&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/v4-shims.css">
<link type="text/css" href="./vendor/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet">
<link type="text/css" href="./css/neumorphism.css" rel="stylesheet">
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
/* Add your own Mailchimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
</head>
<body style="font-family: 'Open Sans', sans-serif; font-size: 16px; color: black;">
<nav class="navbar navbar-expand-lg navbar-transparent navbar-light mb-4" style="background-color: #fafafa;">
<div class="container position-relative">
<a class="navbar-brand mr-lg-5" href="../../index.html">
<!-- <img class="navbar-brand-dark" src="../../assets/img/brand/light.svg" alt="pixel logo">
<img class="navbar-brand-light" src="../../assets/img/brand/dark.svg" alt="pixel logo"> -->
<h2>Ridhima Garg</h2>
</a>
<div class="navbar-collapse collapse" id="navbar-default-primary">
<div class="navbar-collapse-header">
<div class="row">
<div class="col-6 collapse-brand">
<a class="navbar-brand mr-lg-5" href="index.html">
<img class="navbar-brand-dark" src="../../assets/img/brand/light.svg" alt="pixel logo">
<img class="navbar-brand-light" src="../../assets/img/brand/dark.svg" alt="pixel logo">
</a>
</div>
<div class="col-6 collapse-close">
<i class="fas fa-times" data-toggle="collapse" role="button"
data-target="#navbar-default-primary" aria-controls="navbar-default-primary"
aria-expanded="false" aria-label="Toggle navigation"></i>
</div>
</div>
</div>
<ul class="navbar-nav ml-auto text-black font-weight-bold">
<li class="nav-item">
<a href="index.html" class="nav-link">
<h4>About</h4>
</a>
</li>
<li class="nav-item">
<a href="projects.html" class="nav-link">
<h4>Projects</h4>
</a>
</li>
<li class="nav-item">
<a href="moocs.html" class="nav-link">
<h4>MOOCS</h4>
</a>
</li>
<li class="nav-item">
<a href="blogs.html" class="nav-link">
<h4>Blogs</h4>
</a>
</li>
</ul>
</div>
</div>
</nav>
<section class="section section-lg p-2">
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col-md-12 col-lg-12 mb-5">
<!-- Contact Card -->
<div class="card bg-primary shadow-soft border-light p-2 p-md-3 p-lg-2">
<div class="card-header">
<div class="row justify-content-center">
<div class="col-12">
<img src="img/interviewquestions.png" class="card-img-top rounded-top" alt="Voicenet"
height="320" width="400">
</div>
<div class="col-12 col-md-8 text-center mb-5 p-4">
<h1 class="h1 mb-4">Interview Questions and Answers of Machine Learning</h1>
<p class="lead">Have a new project in mind? Need help with an ongoing one? Drop us a line about your project needs, we answer same day.</p>
</div>
</div>
<!--Question1-->
<p class="lead"><b>Q1. Why cost function used for linear regression cannot be used for logistic regression?</b></p>
<p class="lead">Mean Squared Error(Cost function) which is used for linear regression will be a very ziggly plot(non-convex function) for sigmoid function(for cost function) used in logistic regression. It will not be able to converge and stuck in local minimas. </p>
<p class="text-center"><img src="img/blogs/costfunctionlr1.png"/></p>
<!--Question2-->
<p class="lead"><b>Q2. Why cost function of logistic regression has log term?</b></p>
<p class="lead">Simple sigmoid function will be a non-convex function so while taking derivative it will be a ziggly plot. Hence, higher chances of stucking into local minima before reaching global minimum.</p>
<p class="text-center"><img src="img/blogs/q2costfunction.png"></p>
<!--Question3-->
<p class="lead"><b>Q3. What is gini index and how is it used in decision trees?</b></p>
<p class="lead">In layman terms, Gini index is a statistical dispersion which measures the inequality or uncertainity in a block. In terms of decision tree, It will check the purity/homogenity of a node which helps in splitting on that node.
<b>Higher the gini index, higher the homogenity. Below diagram shows how to calculate gini index</b>
</p>
<p class="text-center"><img src="img/blogs/q3giniindexformula.png"><br><br> Here p: success and q:failure</p>
<p class="text-center"><img src="img/blogs/q3calculategini.png"><br>
<a href="https://www.analyticsvidhya.com/blog/2016/04/tree-based-algorithms-complete-tutorial-scratch-in-python/">References -> Analytics Vidhya</a>
</p>
<!--Question4-->
<p class="lead"><b>Q4. What is Information Gain and Entropy?</b></p>
<p class="lead">Entropy is a measure of the uncertainity associated with a set of probabilities. Information gain and entropy is inversely related. If higher entropy then low information gain is required i.e, node is pure.</p>
<!--Question5-->
<p class="lead"><b>Q5. How to choose no. of trees in Random Forest?</b></p>
<p class="lead">Generally, higher the no. of trees is good but a practice is to limit till 200 or 300(depends on # datapoints as well). As you will increase the no. of trees, it will take more time and there is a chance of incease in biasness because for no. of samples(randomly selected) for a tree is the possibility of repition.</p>
<!--Question6-->
<p class="lead"><b>Q6. How to choose weights for trees in random forest?</b></p>
<p class="lead">In random forest, each tree is equally weighted as they are trained on p random features.This ensures that each tree is grown such that -:</p>
<p>1. Reduce Variance - Does not overfit the training data</p>
<p>2. Reduce biasness- Generalise better to new data</p>
<!--Question7-->
<p class="lead"><b>Q7. Why exponential function(e) is used in recomputing the weights of data points in Adaboost algorithm?</b></p>
<p class="lead">It decreases the weights if data point is correctly classified and vice-versa.</p>
<p class="lead">Explanation with formula. Suppose <b>a<sub>i</sub></b> are weights for data points</p>
<p class="text-center"><img src="img/blogs/q7adaboostweightsupdateformula.png"></p>
</div>
<!-- End of Contact Card -->
</div>
</div>
</div>
</section>