ethen8181 / machine-learning Goto Github PK
View Code? Open in Web Editor NEW:earth_americas: machine learning tutorials (mainly in Python3)
License: MIT License
:earth_americas: machine learning tutorials (mainly in Python3)
License: MIT License
The formula for ECE (expected calibration error) includes the size of each bin as weight in the weighted average of the squared errors (|Bm|/n)
The function that uses this formula in the code is called "compute_calibration_error":
https://github.com/ethen8181/machine-learning/blob/master/model_selection/prob_calibration/calibration_module/utils.py#L66
(Link to the code line that sums the errors without weight for each bin size)
Although the bins are created so that they are of approximately equal size, they might differ slightly, and the code does not take this into account, i think the bin_error should be multiplied by the bin size, and the sum of all the errors divided by the number of samples (len of y_true for example) instead of the number of bins (in line 68).
I hope my issue is clear and easy to understand, if not, feel free to ask me for clarification.
class MultiHeadAttention(nn.Module):
in this class, it does not implement the scale of the multiplication of Query and Key.
and in the forward function, it seems that the funcation should return linear_proj , not output?
Hello!
I found an AI-Specific Code smell in your project.
The smell is called: Columns and DataType Not Explicitly Set
You can find more information about it in this paper: https://dl.acm.org/doi/abs/10.1145/3522664.3528620.
According to the paper, the smell is described as follows:
Problem | If the columns are not selected explicitly, it is not easy for developers to know what to expect in the downstream data schema. If the datatype is not set explicitly, it may silently continue the next step even though the input is unexpected, which may cause errors later. The same applies to other data importing scenarios. |
---|---|
Solution | It is recommended to set the columns and DataType explicitly in data processing. |
Impact | Readability |
Example:
### Pandas Column Selection
import pandas as pd
df = pd.read_csv('data.csv')
+ df = df[['col1', 'col2', 'col3']]
### Pandas Set DataType
import pandas as pd
- df = pd.read_csv('data.csv')
+ df = pd.read_csv('data.csv', dtype={'col1': 'str', 'col2': 'int', 'col3': 'float'})
You can find the code related to this smell in this link: https://github.com/ethen8181/machine-learning/blob/916fc7fe0e5e788a1cc8b8f4d24d44f05c492d5e/model_selection/prob_calibration/calibration_module/utils.py#L280-L300.
I also found instances of this smell in other files, such as:
File: https://github.com/ethen8181/machine-learning/blob/master/big_data/sparkml/get_data.py#L21-L31 Line: 26
File: https://github.com/ethen8181/machine-learning/blob/master/data_science_is_software/src/features/build_features.py#L4-L14 Line: 9
File: https://github.com/ethen8181/machine-learning/blob/master/deep_learning/contrastive/clip/clip/utils.py#L5-L15 Line: 10
File: https://github.com/ethen8181/machine-learning/blob/master/model_selection/partial_dependence/partial_dependence.py#L307-L317 Line: 312
.
I hope this information is helpful!
z
variable isn't used in interval calculation:
def sanity_check(size1, size2, significance = 0.05):
n = size1 + size2
confidence = 1 - significance
z = stats.norm.ppf(confidence + significance / 2)
confint = n * 0.5 + np.array([-1, 1]) * np.sqrt(n * 0.5 * 0.5)
return confint
Source: http://ethen8181.github.io/machine-learning/ab_tests/frequentist_ab_test.html#Sanity-Check
Ethen, I have an interesting finding.
If we change the solver of LogisticRegression from 'liblinear' to the default 'lbfgs', theeffect will not be significant with pvalue=0.1605910849805837. What the reason behind this change? why you choose 'liblinear' instead of any other solver? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.