Permalink
Browse files

renamed package

  • Loading branch information...
tyarkoni committed Dec 31, 2014
2 parents 124403c + 5effb27 commit 1ab59f4f041f9d351a6b2ce9b8b8ec1f3438f102
@@ -6,4 +6,5 @@ dist
dist/*
*-checkpoint.ipynb
.ipynb_checkpoints/
setup.cfg
setup.cfg
precis.egg-info
@@ -2,7 +2,7 @@
License
*******
scythe, including all examples, code snippets and attached documentation is
Precis, including all examples, code snippets and attached documentation is
covered by the MIT license.
::
@@ -1,33 +1,33 @@
# scythe
Automated questionnaire abbreviation in Python, as introduced and described in [Yarkoni (2010)](http://pilab.psy.utexas.edu/publications/Yarkoni_JRP_2010a.pdf). Scythe uses customizable genetic algorithms to rapidly abbreviate long questionnaire measures--often reducing their length by as much as 80 - 90% with relatively little loss of fidelity.
# precis
Precis (formerly *scythe*) is a Python package for automated questionnaire abbreviation, as introduced and described in [Yarkoni (2010)](http://pilab.psy.utexas.edu/publications/Yarkoni_JRP_2010a.pdf). precis uses customizable genetic algorithms to rapidly abbreviate long questionnaire measures--often reducing their length by as much as 80 - 90% with relatively little loss of fidelity.
## Installation
Assuming Python and pip are installed, scythe can be installed from PyPI via the command line (note the name--pyscythe, not scythe!):
Assuming Python and pip are installed, precis can be installed from PyPI via the command line:
```
pip install pyscythe
pip install precis
```
Alternatively, for the latest (development) version, install directly from github:
```
pip install git+https://github.com/tyarkoni/scythe.git
pip install git+https://github.com/tyarkoni/precis.git
```
#### Dependencies
Aside from standard scientific python packages (numpy, matplotlib, and pandas--all conveniently included in the [Anaconda](https://store.continuum.io/cshop/anaconda/) bundle), the only current dependency is [deap](https://github.com/DEAP/deap/), which can be installed from PyPI ("pip install deap").
## Quickstart
This example reproduces the core results in [Eisenbarth, Lilienfeld, & Yarkoni (2014)](http://pilab.psy.utexas.edu/publications/Eisenbarth_Psychological_Assessment_2014.pdf). For a more comprehensive and detailed walk-through, including generation of all the figures in the manuscript, see the [demo IPython notebook](https://github.com/tyarkoni/scythe/blob/master/examples/PPI-R/PPI-R%20abbreviation.ipynb), which can be [rendered online](http://nbviewer.ipython.org/github/tyarkoni/scythe/blob/master/examples/PPI-R/PPI-R%20abbreviation.ipynb). All data needed to run the example below can be found in [examples/PPI-R/data](https://github.com/tyarkoni/scythe/tree/master/examples/PPI-R/data).
This example reproduces the core results in [Eisenbarth, Lilienfeld, & Yarkoni (2014)](http://pilab.psy.utexas.edu/publications/Eisenbarth_Psychological_Assessment_2014.pdf). For a more comprehensive and detailed walk-through, including generation of all the figures in the manuscript, see the [demo IPython notebook](https://github.com/tyarkoni/precis/blob/master/examples/PPI-R/PPI-R%20abbreviation.ipynb), which can be [rendered online](http://nbviewer.ipython.org/github/tyarkoni/precis/blob/master/examples/PPI-R/PPI-R%20abbreviation.ipynb). All data needed to run the example below can be found in [examples/PPI-R/data](https://github.com/tyarkoni/precis/tree/master/examples/PPI-R/data).
```python
import scythe
import precis
# Initialize the measure/questionnaire we want to abbreviate.
# We drop all rows with a missing value for at least one item.
ppi = scythe.Measure(X='data/PPI-R_German_data.txt', missing='drop')
ppi = precis.Measure(X='data/PPI-R_German_data.txt', missing='drop')
# Generate scale scores using the PPI-R scoring key, providing names for the columns.
ppi.score(key='data/PPI-R_scoring_key.txt', columns=['B','Ca','Co','F','M','R','So','St'], rescale=True)
# Initialize a new measure generator
gen = scythe.Generator()
gen = precis.Generator()
# Run the generator for 1000 generations
# We'll seed the random number generator to ensure deterministic results.
@@ -39,4 +39,4 @@ abb_ppi.save(prefix='abbreviated')
```
That's it! We should now have two text files in our working directory--one that provides a basic summary of the abbreviated measure, and one that contains a scoring key we can use to automatically score the abbreviated measure's scales using item scores for the original measure.
Scythe provides many more options, including the ability to customize many aspects of the evaluation and abbreviation process (e.g., to adjust the amount of desired abbreviation), as well as various plotting functions that can help us evaluate the quality of the result and track the evolutionary process over successive generations. For a more detailed walk-through of some of these features, see the [demo IPython notebook](http://nbviewer.ipython.org/github/tyarkoni/scythe/blob/master/examples/PPI-R/PPI-R%20abbreviation.ipynb).
precis provides many more options, including the ability to customize many aspects of the evaluation and abbreviation process (e.g., to adjust the amount of desired abbreviation), as well as various plotting functions that can help us evaluate the quality of the result and track the evolutionary process over successive generations. For a more detailed walk-through of some of these features, see the [demo IPython notebook](http://nbviewer.ipython.org/github/tyarkoni/precis/blob/master/examples/PPI-R/PPI-R%20abbreviation.ipynb).
@@ -1,6 +1,6 @@
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 et:
""" scythe.
""" precis.
"""
__all__ = ["abbreviate", "base", "evaluate", "generate", "plot", "stats", "set_logging_level", "__version__"]
@@ -15,7 +15,7 @@
from version import __version__
logger = logging.getLogger("scythe")
logger = logging.getLogger("precis")
def set_logging_level(level=None):
"""Set logging level
@@ -24,10 +24,10 @@ def set_logging_level(level=None):
level : str
Name of the logging level (warning, error, info, etc) known
to logging module. If no level provided, it would get that one
from environment variable scythe_LOGLEVEL
from environment variable precis_LOGLEVEL
"""
if level is None:
level = os.environ.get('scythe_LOGLEVEL', 'warn')
level = os.environ.get('precis_LOGLEVEL', 'warn')
if level is not None:
logger.setLevel(getattr(logging, level.upper()))
return logger.getEffectiveLevel()
@@ -1,6 +1,6 @@
import numpy as np
import abc
from scythe.base import Measure
from precis.base import Measure
@@ -2,14 +2,14 @@
import numpy as np
import pandas as pd
import logging
from scythe import stats
from scythe import plot
from precis import stats
from precis import plot
import random
import copy
import os
logger = logging.getLogger('scythe')
logger = logging.getLogger('precis')
class Dataset(object):
@@ -2,7 +2,7 @@
import numpy as np
import abc
from scythe.base import Measure
from precis.base import Measure
@@ -4,10 +4,10 @@
import copy
import logging
import random
from scythe import abbreviate
from scythe import evaluate
from scythe import plot
from scythe.base import AbbreviatedMeasure
from precis import abbreviate
from precis import evaluate
from precis import plot
from precis.base import AbbreviatedMeasure
class Generator:
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -16,19 +16,19 @@
)
# fetch version from within module
with open(os.path.join('scythe', 'version.py')) as f:
with open(os.path.join('precis', 'version.py')) as f:
exec(f.read())
setup(name="pyscythe",
setup(name="precis",
version=__version__,
description="Genetic algorithm-based measure abbreviation in Python.",
author='Tal Yarkoni',
author_email='tyarkoni@gmail.com',
url='http://github.com/tyarkoni/scythe',
packages=["scythe"],
package_data={'scythe': ['data/*'],
'scythe.tests': ['data/*']
url='http://github.com/tyarkoni/precis',
packages=["precis"],
package_data={'precis': ['data/*'],
'precis.tests': ['data/*']
},
download_url='https://github.com/tyarkoni/scythe/archive/%s.tar.gz' % __version__,
download_url='https://github.com/tyarkoni/precis/archive/%s.tar.gz' % __version__,
**extra_setuptools_args
)

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,154 @@
0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0
0 0 0 -1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 -1 0 0 0 0 0
0 0 0 0 0 0 0 -1
0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 -1 0 0 0 0 0
0 0 0 0 0 0 0 -1
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 0
0 0 0 0 -1 0 0 0
1 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 -1 0
0 0 0 0 0 0 -1 0
0 0 0 0 1 0 0 0
0 0 0 0 0 0 -1 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 -1 0 0 0 0 0
0 0 0 0 0 0 0 -1
0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 -1 0 0 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0
1 0 0 0 0 0 0 0
0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 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 -1 0 0 0 0 0 0
0 0 -1 0 0 0 0 0
0 0 -1 0 0 0 0 0
0 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 0 0 0 0 0 -1 0
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 -1
0 0 -1 0 0 0 0 0
0 -1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 -1 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 -1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 0 1 0 0 0
0 -1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 0 0 0 0 0 -1 0
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 -1
0 0 -1 0 0 0 0 0
0 -1 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 -1 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 -1 0 0 0 0 0 0
0 0 -1 0 0 0 0 0
0 0 0 0 1 0 0 0

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,8 +1,8 @@
import unittest
import pandas as pd
import numpy as np
from scythe import evaluate, abbreviate
from scythe.base import Dataset, Measure
from precis import evaluate, abbreviate
from precis.base import Dataset, Measure
from helpers import get_test_data_path as tdp
from os.path import join
@@ -1,6 +1,6 @@
import unittest
from scythe.base import Dataset, Measure
from scythe.generate import Generator
from precis.base import Dataset, Measure
from precis.generate import Generator
import pandas as pd
import numpy as np
from helpers import get_test_data_path as tdp
@@ -1,10 +1,10 @@
import unittest
import pandas as pd
import numpy as np
from scythe.generate import Generator
from scythe.base import Measure
from scythe import abbreviate
from scythe import plot as sp
from precis.generate import Generator
from precis.base import Measure
from precis import abbreviate
from precis import plot as sp
import matplotlib.pyplot as plt
from helpers import get_test_data_path as tdp
from os.path import join
@@ -1,4 +1,4 @@
from scythe import stats as gs
from precis import stats as gs
import numpy as np
import numpy.testing as npt
import unittest

0 comments on commit 1ab59f4

Please sign in to comment.