Skip to content

Commit

Permalink
refactoring irt, remove data, add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
inuyasha2012 committed Sep 27, 2018
1 parent aec73a9 commit df916fb
Show file tree
Hide file tree
Showing 63 changed files with 2,031 additions and 8,648 deletions.
500 changes: 0 additions & 500 deletions data/ctt.csv

This file was deleted.

1,000 changes: 0 additions & 1,000 deletions data/lsat.csv

This file was deleted.

500 changes: 0 additions & 500 deletions demo/data/ctt.csv

This file was deleted.

500 changes: 0 additions & 500 deletions demo/data/ex5.11.dat

This file was deleted.

500 changes: 0 additions & 500 deletions demo/data/ex5.2.dat

This file was deleted.

500 changes: 0 additions & 500 deletions demo/data/ex5.5.dat

This file was deleted.

500 changes: 0 additions & 500 deletions demo/data/ex5.6.dat

This file was deleted.

1,000 changes: 0 additions & 1,000 deletions demo/data/lsat.csv

This file was deleted.

5 changes: 2 additions & 3 deletions demo/demo_ccfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# 属性数据下的验证性因子分析
from __future__ import print_function, division, unicode_literals
import numpy as np
from psy import delta_i_ccfa
from psy import delta_i_ccfa, data

data = np.loadtxt('data/ex5.2.dat')
lam0 = np.array([
[1, 0],
[1, 0],
Expand All @@ -13,7 +12,7 @@
[0, 1],
[0, 1]
])
lam, phi, theta = delta_i_ccfa(data, lam0)
lam, phi, theta = delta_i_ccfa(data['ex5.2.dat'], lam0)
print('===因子载荷===')
print(lam)
print('===因子得分协方差矩阵===')
Expand Down
8 changes: 4 additions & 4 deletions demo/demo_ccfa_irt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# 利用属性数据下的验证性因子分析计算项目反应模型的参数
from __future__ import print_function, division, unicode_literals
import numpy as np
from psy import delta_i_ccfa, get_irt_parameter, get_thresholds
from psy import delta_i_ccfa, get_irt_parameter, get_thresholds, data

data = np.loadtxt('data/lsat.csv', delimiter=',')
score = data['lsat.dat']
lam0 = np.ones((5, 1))
lam, phi, theta = delta_i_ccfa(data, lam0)
_thresholds = get_thresholds(data)
lam, phi, theta = delta_i_ccfa(score, lam0)
_thresholds = get_thresholds(score)
thresholds = np.array(_thresholds)
a, b = get_irt_parameter(lam, thresholds, theta)

Expand Down
5 changes: 2 additions & 3 deletions demo/demo_cfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# 正态数据下的验证性因子分析
from __future__ import print_function, division, unicode_literals
import numpy as np
from psy import cfa
from psy import cfa, data

lam = np.array([
[1, 0, 0, 0],
Expand All @@ -19,8 +19,7 @@
[0, 0, 0, 1],
])

data = np.loadtxt('data/ex5.6.dat')
lam, phi, var_e = cfa(data, lam)
lam, phi, var_e = cfa(data['ex5.6.dat'], lam)
# 因子载荷
print(lam)
# 误差方差
Expand Down
3 changes: 2 additions & 1 deletion demo/demo_ctt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# 经典测量理论
from __future__ import print_function, division, unicode_literals
from psy.ctt import BivariateCtt
from psy import data
import numpy as np

score = np.loadtxt('data/lsat.csv', delimiter=",")
score = data['lsat.dat']
ctt = BivariateCtt(score)
print(ctt.get_alpha_reliability())
print(ctt.get_composite_reliability())
Expand Down
4 changes: 2 additions & 2 deletions demo/demo_fa.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# 探索性因子分析
from __future__ import print_function, division, unicode_literals
import numpy as np
from psy import Factor
from psy import Factor, data

score = np.loadtxt('data/lsat.csv', delimiter=",")
score = data['lsat.dat']
factor = Factor(score, 5)
print(factor.loadings)
5 changes: 2 additions & 3 deletions demo/demo_grm.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# coding=utf-8
# 项目反应理论中的等级反应模型
from __future__ import division, print_function, unicode_literals
from psy import Grm
import numpy as np
from psy import Grm, data

scores = np.loadtxt('data/lsat.csv', delimiter=',')
scores = data['lsat.dat']
grm = Grm(scores=scores)
print(grm.em())
13 changes: 13 additions & 0 deletions demo/demo_irt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# coding=utf-8
# 单维IRT参数估计
from __future__ import print_function, division, unicode_literals
from psy import Irt, data

score = data['lsat.dat']
model = Irt(scores=score, link='probit')
res = model.fit()
print(res)

model = Irt(scores=score, link='logit')
res = model.fit()
print(res)
9 changes: 0 additions & 9 deletions demo/demo_irt2pl.py

This file was deleted.

7 changes: 3 additions & 4 deletions demo/demo_mirt2pl.py → demo/demo_mirt.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# coding=utf-8
# 多维项目反应理论的参数估计
from __future__ import print_function, division, unicode_literals
import numpy as np
from psy import Mirt2PL
from psy import Mirt, data

score = np.loadtxt('data/lsat.csv', delimiter=",")
res = Mirt2PL(scores=score, dim_size=2).em()
score = data['lsat.dat']
res = Mirt(scores=score, dim_size=2).em()
print(res[2])
print(res[0])
9 changes: 0 additions & 9 deletions demo/demo_probit_irt.py

This file was deleted.

6 changes: 3 additions & 3 deletions demo/demo_sem.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# coding=utf-8
# 结构方程模型的参数估计
from __future__ import division, print_function, unicode_literals
from psy import sem, data
import numpy as np
from psy import sem

data = np.loadtxt('data/ex5.11.dat')
data_ = data['ex5.11.dat']

beta = np.array([
[0, 0],
Expand Down Expand Up @@ -38,7 +38,7 @@
[0, 1],
])

lam_x, lam_y, phi_x, beta, gamma, var_e, var_e_x, var_e_y = sem(data, y, x, lam_x, lam_y, beta, gamma)
lam_x, lam_y, phi_x, beta, gamma, var_e, var_e_x, var_e_y = sem(data_, y, x, lam_x, lam_y, beta, gamma)

print('==========内源变量因子载荷=========')
print(lam_x)
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import sys
sys.path.insert(0, os.path.abspath('..'))

import pypsy
import psy

# -- General configuration ---------------------------------------------

Expand Down Expand Up @@ -56,9 +56,9 @@
# the built documents.
#
# The short X.Y version.
version = pypsy.__version__
version = psy.__version__
# The full version, including alpha/beta/rc tags.
release = pypsy.__version__
release = psy.__version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
7 changes: 7 additions & 0 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API
===

.. toctree::
:maxdepth: 4

psy
22 changes: 22 additions & 0 deletions docs/psy.cat.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
psy.cat package
===============

Submodules
----------

psy.cat.tirt module
-------------------

.. automodule:: psy.cat.tirt
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: psy.cat
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions docs/psy.cdm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
psy.cdm package
===============

Submodules
----------

psy.cdm.irm module
------------------

.. automodule:: psy.cdm.irm
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: psy.cdm
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions docs/psy.ctt.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
psy.ctt package
===============

Submodules
----------

psy.ctt.ctt module
------------------

.. automodule:: psy.ctt.ctt
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: psy.ctt
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions docs/psy.data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
psy.data package
================

Submodules
----------

psy.data.data module
--------------------

.. automodule:: psy.data.data
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: psy.data
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions docs/psy.exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
psy.exceptions package
======================

Submodules
----------

psy.exceptions.cat module
-------------------------

.. automodule:: psy.exceptions.cat
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: psy.exceptions
:members:
:undoc-members:
:show-inheritance:
30 changes: 30 additions & 0 deletions docs/psy.fa.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
psy.fa package
==============

Submodules
----------

psy.fa.factors module
---------------------

.. automodule:: psy.fa.factors
:members:
:undoc-members:
:show-inheritance:

psy.fa.rotations module
-----------------------

.. automodule:: psy.fa.rotations
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: psy.fa
:members:
:undoc-members:
:show-inheritance:
38 changes: 38 additions & 0 deletions docs/psy.irt.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
psy.irt package
===============

Submodules
----------

psy.irt.base module
-------------------

.. automodule:: psy.irt.base
:members:
:undoc-members:
:show-inheritance:

psy.irt.grm module
------------------

.. automodule:: psy.irt.grm
:members:
:undoc-members:
:show-inheritance:

psy.irt.irm module
------------------

.. automodule:: psy.irt.irm
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: psy.irt
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit df916fb

Please sign in to comment.