Comments (3)
Added latent ability estimation, works well. The Blue line is the true latent ability distribution, the red is estimated from the data and the black is a standard normal distribution. Need to propagate it through the estimation functions and write unittests.
from girth.
Added the latent distribution estimation to most of the algorithms, need to fix unittests.
from girth.
Ability estimation is available in 2pl_mml (through grm_mml), grm_mml, pcm_mml and gum_mml methods. It is not turned on by default, and the estimated samples default to 9.
Below is an example to demonstrate it:
import numpy as np
from scipy import stats
from bokeh.plotting import figure, show, output_notebook
from girth import create_synthetic_irt_dichotomous, create_synthetic_irt_polytomous
from girth import grm_mml
output_notebook()
np.random.seed(1124)
x = np.linspace(-4, 4, 1001)
# Random parameters
loc1 = -np.random.rand(1) - .4
loc2 = np.random.rand(1) + .4
scale1 = 0.3 + np.random.rand(1) * 0.7
scale2 = 0.3 + np.random.rand(1) * 0.7
weight1 = np.random.rand(1)
weight2 = 1 - weight1
# Initial distiribution
n = (weight1 * stats.distributions.norm.pdf(x, loc=loc1, scale=scale1) +
weight2 * stats.distributions.norm.pdf(x, loc=loc2, scale=scale2))
n /= n.sum()
# Get the adjustment factors
mn = x.dot(n)
std = np.sqrt(n.dot((x - mn)**2))
# Scale to be zero mean and unit variance
n = (weight1 * stats.distributions.norm.pdf(x * std, loc=loc1-mn, scale=scale1) +
weight2 * stats.distributions.norm.pdf(x * std, loc=loc2-mn, scale=scale2))
n /= n.sum()
# Set the hypothetical study
n_participants = 1000
n_items = 20
# get a distribution of abilitites
theta = np.random.choice(x, size=n_participants, p=n/n.sum())
difficulty = np.random.randn(n_items, 4)
difficulty = np.sort(difficulty, axis=1)
discrimination = np.random.rand(n_items) + 0.75
# Create the synthetic data
syn_data_grm = create_synthetic_irt_polytomous(difficulty, discrimination, theta, model='grm')
# Estimate the parameters
output = grm_mml(syn_data_grm, options={"estimate_distribution": True,
"number_of_samples": 11})
xx, yy = output['LatentPDf'].cubic_splines[-1].continuous_pdf()
scalar = (xx[2] - xx[1]) / (x[2] - x[1])
p = figure()
p.line(x, n, legend_label="Truth")
p.line(xx, yy / scalar / yy.sum(), color='red', legend_label="Estimated")
show(p)
The result should look like below:
from girth.
Related Issues (20)
- Add initial guess method for multidimensional models HOT 1
- Investigate removing numba support HOT 1
- Add citation fille HOT 1
- Girth Rebrand HOT 6
- Add disclaimer about Rasch Models
- what is proper choice for sparse response HOT 2
- IRT at Scale
- November Code Refactor HOT 1
- Remove Correlated Abilities
- Unify dichotomous synthetic data creation. HOT 1
- Clean up Read-me File
- Remove irt function
- Directory Structure Refactor HOT 1
- Multi-dimensional Initial Guess Not Semi-Positive Definite
- I don't know where to take on it? HOT 4
- NaN encountered warning with `grm_mml`
- "float128" data type is not understood (grm_mml_eap)
- Installation does not seem to work HOT 1
- twopl_mml , threepl_mml model are taking too much time
- RuntimeError: An attempt has been made to start a new process before the current process has finished its bootstrapping phase. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from girth.