Thursday, July 21, 2022

Machine Learning MCQ - Cost function of logistic regression is convex

Multiple choices questions in Machine learning. Interview questions on machine learning, quiz questions for data scientist answers explained, what is the cost function of logistic regression? Why the cost function used in linear regression cannot be used in logistic regression? Why the cost function of logistic regression is convex?

Machine Learning MCQ - Cost function of logistic regression is convex

< Previous                      

Next >

 

1. Which of the following statements about logistic regression are correct?

a) Logistic regression uses the squared error as the loss function

b) Logistic regression assumes that each class’s points are generated from a Gaussian distribution

c) The cost function of logistic regression is concave

d) The cost function of logistic regression is convex

Answer: (d) The cost function of logistic regression is convex


Gradient descent will converge into global minimum only if the cost function is convex in the case of logistic regression.

 

Can we use the same cost function used in linear regression for logistic regression?

If we use the cost function of linear regression (Mean Squared Error) in logistic regression, we end up with a non-convex function with many local minimums. In this case, it is very difficult to find the global minimum. This strange outcome is due to the fact that in logistic regression we have the sigmoid function around, which is non-linear (i.e. not a line).

   

< Previous                      

Next >

 

************************

Related links:

Why the cost function of logistic regression is convex?

Why can't we use the cost function of linear regression in the case of logistic regression?

Can we use the same cost function of linear regression in logistic regression?

What will happen if you use linear regression's cost function in logistic regression?

Machine learning solved mcq, machine learning solved mcq

Sunday, July 17, 2022

Data Structures and Algorithms MCQ - Best sorting algorithms in terms of both time complexity and auxiliary space needed

Multiple choices questions in DSA, Interview questions in DSA, Data Structures and Algorithms solved questions, Which sorting algorithm is best? Why heap sort is comparatively best algorithm if memory is the major concern? How much auxiliary spaces need for bubble sort, heap sort and insertion sort? Why merge sort is not a best option if memory is a major concern?

DSA solved MCQ - Which sorting technique is best in terms of time complexity and auxiliary space used?

< Previous                      

Next >

 

Answer: (b) Heap sort

Among the given sorting algorithms, heap sort is the best option if memory is a real concern for you.

Heap sort uses O(1) auxiliary space (i.e., constant) since it is an in-place sorting algorithm. Also, the worst case running complexity is O(n log n). With a small worst-case running time and efficient space usage, heap sort is the best option among the others.

On the other hand, merge sort takes up O(n) auxiliary space. Though the auxiliary space requirement for both bubble and insertion sort are constant (O(1)),  the worst case time complexity is O(n2) for both the algorithms.

Algorithm

Auxiliary space required

Worst case time complexity

Heap sort

O(1)

O(n log n)

Merge sort

O(n)

O(n log n)

Bubble sort

O(1)

O(n2)

Insertion sort

O(1)

O(n2)


< Previous                      

Next >


************************

Related links:

Why merge sort is not a best option if memory is a major concern for you? Merge sort is not a good option if memory is a major concern because it needs O(n) auxiliary memory space to store the merged sub-array.

Among bubble sort, insertion sort, quick sort and heap sort, which is best option if the memory requirement is an issue?

Which sorting algorithm is best with respect to the amount of auxiliary space needed?

Comparison of sorting algorithms in terms of the auxiliary space needed to store elements

DSA solved MCQ; data structures and algorithms MCQ solved questions

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery