-
Notifications
You must be signed in to change notification settings - Fork 185
Added Two New Questions(Probability + ML) #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jeet009
wants to merge
6
commits into
Open-Deep-ML:main
Choose a base branch
from
Jeet009:jeetm/newq
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5e2a9a9
Added Two New Questions(Probability)
Jeet009 558c2fc
Added Two New Questions(Probability)-184,185
Jeet009 b1d2a46
Updated the questions with fixes
Jeet009 84b8324
Updated the questions with fixes
Jeet009 b903254
Updated the questions with fixes(added new supported notations)
Jeet009 57e1293
Added Q: Linear Regression using OLS
Jeet009 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Updated the questions with fixes
- Loading branch information
commit b1d2a464212381175bdacad2fc8c1f3c42de2f75
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,41 @@ | ||
| ## Solution Explanation | ||
| ## Learning: PMF normalization constant | ||
|
|
||
| For a valid PMF, probabilities must sum to 1. | ||
| ### Idea and formula | ||
| - **PMF requirement**: A probability mass function must satisfy ∑ p(xᵢ) = 1 and p(xᵢ) ≥ 0. | ||
| - **Normalization by a constant**: If probabilities are given up to a constant, you determine that constant by enforcing the sum-to-1 constraint. | ||
| - If the form is p(xᵢ) = K · wᵢ with known nonnegative weights wᵢ, then | ||
| - ∑ p(xᵢ) = K · ∑ wᵢ = 1 ⇒ **K = 1 / ∑ wᵢ**. | ||
| - If the given expressions involve K in a more general way (e.g., both K and K² terms), still enforce ∑ p(xᵢ) = 1 and solve the resulting equation for K. Choose the solution that makes all probabilities nonnegative. | ||
|
|
||
| Sum all terms: | ||
| ### Worked example (this question) | ||
| Suppose the PMF entries are expressed in terms of K such that, when summed, the K-terms group as follows: | ||
|
|
||
| - Linear in K: K + 2K + 2K + 3K + K = 9K | ||
| - Quadratic in K: K^2 + 2K^2 + 7K^2 = 10K^2 | ||
| - Quadratic in K: K² + 2K² + 7K² = 10K² | ||
|
|
||
| Therefore: 10K^2 + 9K = 1 => 10K^2 + 9K - 1 = 0 | ||
| One concrete way to realize this is via the following table of outcomes and probabilities: | ||
|
|
||
| Solve the quadratic: K = [-9 ± sqrt(81 + 40)] / 20 = [-9 ± 11] / 20 | ||
| | X | p(X) | | ||
| |----|--------------| | ||
| | x₁ | K + K² | | ||
| | x₂ | 2K + 2K² | | ||
| | x₃ | 2K | | ||
| | x₄ | 3K + 7K² | | ||
| | x₅ | K | | ||
|
|
||
| Feasible solution (K ≥ 0): K = 2/20 = 0.1 | ||
| These add up to 9K + 10K² as required. | ||
|
|
||
| So the normalization constant is K = 0.1. | ||
| Enforce the PMF constraint: | ||
|
|
||
| - 9K + 10K² = 1 ⇒ 10K² + 9K − 1 = 0 | ||
|
|
||
| Quadratic formula reminder: | ||
|
|
||
| - For aK² + bK + c = 0, the solutions are K = [−b ± √(b² − 4ac)] / (2a). | ||
|
|
||
| Solve the quadratic: | ||
|
|
||
| - K = [−9 ± √(9² + 4·10·1)] / (2·10) = [−9 ± √121] / 20 = [−9 ± 11] / 20 | ||
| - Feasible (K ≥ 0) root: K = (−9 + 11) / 20 = 2/20 = 0.1 | ||
|
|
||
| Therefore, the normalization constant is **K = 0.1**. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| { | ||
| "id": "183", | ||
| "id": "185", | ||
| "title": "Find PMF Normalization Constant", | ||
| "difficulty": "easy", | ||
| "difficulty": "medium", | ||
| "category": "Probability & Statistics", | ||
| "video": "", | ||
| "likes": "0", | ||
| "dislikes": "0", | ||
| "contributor": [ | ||
| { | ||
| "profile_link": "https://github.com/jeetmukherjee", | ||
| "name": "jeetmukherjee" | ||
| "profile_link": "https://github.com/Jeet009", | ||
| "name": "Jeet Mukherjee" | ||
| } | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here are the rules for the learn section and how to create formulas, also currently we do not render charts on the site
Writing Mathematical Expressions with LaTeX
This editor supports LaTeX for rendering mathematical equations and expressions. Here's how you can use it:
Inline Math:
$symbols.$E = mc^2$→ Renders as: (Block Math:
$$symbols.$$
\int_a^b f(x) , dx
$$
Math Functions:
\frac,\sqrt,\sum, etc.$\frac{a}{b}$→ ($\sqrt{x}$→ (Greek Letters and Symbols:
\alpha,\beta, etc., for Greek letters.$\alpha + \beta = \gamma$→ (Subscripts and Superscripts:
_{}for subscripts and^{}for superscripts.$x_i$→ ($x^2$→ (Combined Examples:
$\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}$Renders as:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Open-Deep-ML, thanks for this. I have updated the notations in LaTeX format. Please take a look and let me know if this is fine now.