Skip to content

Instantly share code, notes, and snippets.

View Harsh78Anand's full-sized avatar
🎯
Focusing

Harsh Anand Harsh78Anand

🎯
Focusing
  • Pepcoding Education Private Limited
  • Noida, UP, India
View GitHub Profile
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Lottery{
address public manager;
address payable[] public players;
constructor(){
@Harsh78Anand
Harsh78Anand / FAQ
Created December 20, 2021 06:54
SQL Subqueries
#FAQ
Q1. Subqueries can be written inside which sql clauses?
Ans. Subqueries can be written inside a SELECT, FROM, WHERE, or HAVING clause.
Q2. What are the major advantages of using subqueries?
Ans. Using subqueries allows us to access data from multiple tables without having to perform complex joins and also they are quite easy to understand.
Q3. What does the 'ANY' keyword do?
Ans. Any operator returns a boolean value. It checks if any of the subquery values meet the condition and returns a boolean value accordingly.
@Harsh78Anand
Harsh78Anand / FAQ
Created December 20, 2021 06:21
Transaction
#FAQ
Q1. What does the atomicity property of databases state?
Ans. Atomicity property states that for a transaction to commit successfully, every task of the transaction must be completed successfully and if a single task fails, the whole transaction fails.
Q2. What does the 'SET TRANSACTION' command do?
Ans. The SET TRANSACTION command is used to specify characteristics for the transaction that follows. For example, we can specify a transaction to be read only or read write.
Q3. How do we rollback to a savepoint?
Ans. To rollback to a savepoint we use 'ROLLBACK TO SP' where SP is the name of that savepoint.
@Harsh78Anand
Harsh78Anand / FAQ
Created December 20, 2021 05:44
Normalization
#FAQ
Q1. What problem does redundant data causes in the database?
Ans. Reduntant data in a table/database leads to insertion anomaly, updation anomaly and deletion anomaly.
Q2. What does partial dependency mean?
Ans. Partial dependency means when an attribute(column) or set of attributes is/are dependent upon a proper set of candidate keys.
Q3. What are the conditions for BCNF?
Ans. For a table to be in BCNF, the table should be in 3NF and if there is a functional dependency A → B, then A has to be the Super Key of that particular table.
@Harsh78Anand
Harsh78Anand / FAQ
Created December 20, 2021 04:53
Keys and Constraints
#FAQ
Q1. Can a foreign key be null?
Ans. Yes, a foreign key can be null as long as there is no 'Unique' constraint on it.
Q2. What does a check constraint do?
Ans. Check constraint ensures that the values in a column satisfy a specific condition.
Q3. What is an Alternate key?
Ans. Alternate keys are those candidate keys which are not the Primary key.
@Harsh78Anand
Harsh78Anand / FAQ
Last active December 2, 2021 04:30
Vanishing Gradient
#FAQ
Q1. What was the main cause behind vanishing gradient?
Ans. Vanishing gradient mostly occured when the variance in outputs were a lot more than that in the inputs in the hidden layers.
Q2. What problem occurred when sigmoid function was used as activation function?
Ans. Sigmoid function is a saturating function which meant for large positive or negative numbers the value becomes constant which lead to close to zero gradient, so there was a large chance of vanishing gradient problem.
Q3. What is the activation function used with LeCun initialization?
Ans. SELU activation function is used with LeCun initialization.
@Harsh78Anand
Harsh78Anand / FAQ
Last active November 30, 2021 19:25
Non saturating Activation Function
#FAQ
Q1. Why do we not prefer linear activation functions?
Ans. Linear functions do not any scaling and will return the values as it is. So, if our dataset has non-linear data we would not be able to perform classification properly.
Q2. What is the 'dying relu' problem?
Ans. The 'Relu' activation function returns '0' for all the negative values, so if half our dataset consists of negative values, we would have a lot of dead neurons as they would return '0'.This is called as dying relu problem.
Q3. What is the range for leaky relu activation function?
Ans. The range for tanh function is '–∞' to '∞'.
@Harsh78Anand
Harsh78Anand / FAQ
Created November 25, 2021 06:42
Bayesian Gaussian Mixtures
#FAQ
Q1. What limitation of GMM does the Bayesian GMM overcome?
Ans. In GMM, we can't easily determine the optimal number of clusters to form, while BGMM assigns 'zero' or close to 'zero' weights to those clusters which don't have any influence on our model.
Q2.
@Harsh78Anand
Harsh78Anand / FAQ
Created November 25, 2021 06:38
Anomaly Detection
Q1. What does Anomaly mean in terms of machine learning?
Ans. Anomaly, also called as outliers, are basically the instances which deviate strongly from the normal dataset values.
Q2. How is Anomaly detection helpful in real life applications?
Ans. Anomaly detection can be used for fraud detection, to detect defective products in manufacturing and to detect outliers in datasets.
Q3. How do we identify outlier?
Ans. Outliers can be identified by finding out the instances located in low density regions which determined by a threshold.
Q4. How can we reduced false positives in anomaly detection?
@Harsh78Anand
Harsh78Anand / FAQ
Created November 25, 2021 06:29
GMM implementation
#FAQ
Q1. What does the 'n_components' hyperparameter of the GMM model do?
Ans. The n_components hyperparameter specifies the number of clusters(gaussian distributions) we want to form in our model.
Q2. How do we implement hard clustering and soft clustering in our model?
Ans. To implement hard clustering we use predict() method and to implement soft clustering we use predict_proba() method.
Q3. How do we get the probability densities of the instances?
Ans. We can get probability densities using the score_samples.