зеркало из https://github.com/microsoft/SparseSC.git
Rename RidgeSC to SparseSC
This commit is contained in:
Родитель
6e9d313ccb
Коммит
c8b6995f2a
|
@ -1,4 +1,4 @@
|
|||
# Ridge Synthetic Controls
|
||||
# Sparse Synthetic Controls
|
||||
|
||||
### Setup
|
||||
|
||||
|
@ -138,7 +138,7 @@ and one column per covariate or observed outcome, scores for a grid of
|
|||
parameters `LAMBDA` can be obtained as follows:
|
||||
|
||||
```python
|
||||
import RidgeSC as SC
|
||||
import SparseSC as SC
|
||||
import numpy as np
|
||||
|
||||
# Obtain LAMBDA_max and a grid over which to search
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
# PRIMARY FITTING FUNCTIONS
|
||||
from RidgeSC.fit_loo import loo_v_matrix, loo_weights, loo_score
|
||||
from RidgeSC.fit_ct import ct_v_matrix, ct_weights, ct_score
|
||||
|
||||
# Public API
|
||||
from RidgeSC.cross_validation import score_train_test, score_train_test_sorted_lambdas, CV_score, joint_penalty_optimzation, estimate_effects
|
||||
from RidgeSC.tensor import tensor
|
||||
from RidgeSC.weights import weights
|
||||
from RidgeSC.lambda_utils import get_max_lambda, L2_pen_guestimate
|
||||
|
||||
# The version as used in the setup.py
|
||||
__version__ = "0.1.0"
|
|
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28010.2016
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "RidgeSC", "RidgeSC\RidgeSC.pyproj", "{3FDC664A-C1C8-47F0-8D77-8E0679E53C82}"
|
||||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "SparseSC", "SparseSC\SparseSC.pyproj", "{3FDC664A-C1C8-47F0-8D77-8E0679E53C82}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{AA17F266-A75A-4FDE-A774-168EADE9A32E}"
|
||||
ProjectSection(SolutionItems) = preProject
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# PRIMARY FITTING FUNCTIONS
|
||||
from SparseSC.fit_loo import loo_v_matrix, loo_weights, loo_score
|
||||
from SparseSC.fit_ct import ct_v_matrix, ct_weights, ct_score
|
||||
|
||||
# Public API
|
||||
from SparseSC.cross_validation import score_train_test, score_train_test_sorted_lambdas, CV_score, joint_penalty_optimzation, estimate_effects
|
||||
from SparseSC.tensor import tensor
|
||||
from SparseSC.weights import weights
|
||||
from SparseSC.lambda_utils import get_max_lambda, L2_pen_guestimate
|
||||
|
||||
# The version as used in the setup.py
|
||||
__version__ = "0.1.0"
|
|
@ -1,8 +1,8 @@
|
|||
from RidgeSC.fit_fold import fold_v_matrix, fold_score
|
||||
from RidgeSC.fit_loo import loo_v_matrix, loo_score, loo_weights
|
||||
from RidgeSC.fit_ct import ct_v_matrix, ct_score
|
||||
from RidgeSC.optimizers.cd_line_search import cdl_search
|
||||
from RidgeSC.lambda_utils import get_max_lambda, L2_pen_guestimate
|
||||
from SparseSC.fit_fold import fold_v_matrix, fold_score
|
||||
from SparseSC.fit_loo import loo_v_matrix, loo_score, loo_weights
|
||||
from SparseSC.fit_ct import ct_v_matrix, ct_score
|
||||
from SparseSC.optimizers.cd_line_search import cdl_search
|
||||
from SparseSC.lambda_utils import get_max_lambda, L2_pen_guestimate
|
||||
import atexit
|
||||
import numpy as np
|
||||
import itertools
|
||||
|
@ -476,8 +476,8 @@ def _gen_placebo_stats_from_diffs(N1, effect_vec, std_effect_vec, joint_effect,
|
|||
|
||||
EstResultCI = namedtuple('EstResults', 'effect p ci')
|
||||
|
||||
RidgeSCEstResults = namedtuple('RidgeSCEstResults', 'effect_vec_res std_p joint_p joint_std_p N_placebo placebo_effect_vecs')
|
||||
ret_struct = RidgeSCEstResults(EstResultCI(effect_vec, p2s, CIs), p2s_std, joint_p, joint_std_p, comb_len, placebo_effect_vecs)
|
||||
SparseSCEstResults = namedtuple('SparseSCEstResults', 'effect_vec_res std_p joint_p joint_std_p N_placebo placebo_effect_vecs')
|
||||
ret_struct = SparseSCEstResults(EstResultCI(effect_vec, p2s, CIs), p2s_std, joint_p, joint_std_p, comb_len, placebo_effect_vecs)
|
||||
return ret_struct
|
||||
|
||||
def estimate_effects(X, Y_pre, Y_post, treated_units, max_n_pl = 1000000, ret_pl = False, ret_CI=False, level=0.95, **kwargs):
|
|
@ -1,7 +1,7 @@
|
|||
from numpy import ones, diag, matrix, zeros, absolute, mean,var, linalg, prod, sqrt
|
||||
import numpy as np
|
||||
import warnings
|
||||
from RidgeSC.optimizers.cd_line_search import cdl_search
|
||||
from SparseSC.optimizers.cd_line_search import cdl_search
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
def ct_v_matrix(X,
|
|
@ -2,8 +2,8 @@ from numpy import ones, diag, matrix, zeros, mean,var, linalg, prod, sqrt, absol
|
|||
import numpy as np
|
||||
import itertools
|
||||
import warnings
|
||||
#from RidgeSC.utils.sub_matrix_inverse import subinv_k, all_subinverses
|
||||
from RidgeSC.optimizers.cd_line_search import cdl_search
|
||||
#from SparseSC.utils.sub_matrix_inverse import subinv_k, all_subinverses
|
||||
from SparseSC.optimizers.cd_line_search import cdl_search
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
|
|
@ -3,8 +3,8 @@ import numpy as np
|
|||
import itertools
|
||||
import warnings
|
||||
# only used by the step-down method (currently not implemented):
|
||||
# from RidgeSC.utils.sub_matrix_inverse import subinv_k, all_subinverses
|
||||
from RidgeSC.optimizers.cd_line_search import cdl_search
|
||||
# from SparseSC.utils.sub_matrix_inverse import subinv_k, all_subinverses
|
||||
from SparseSC.optimizers.cd_line_search import cdl_search
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
def complete_treated_control_list(N, treated_units = None, control_units = None):
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
from RidgeSC.fit_loo import loo_v_matrix
|
||||
from RidgeSC.fit_ct import ct_v_matrix
|
||||
from RidgeSC.fit_fold import fold_v_matrix
|
||||
# from RidgeSC.optimizers.cd_line_search import cdl_search
|
||||
from SparseSC.fit_loo import loo_v_matrix
|
||||
from SparseSC.fit_ct import ct_v_matrix
|
||||
from SparseSC.fit_fold import fold_v_matrix
|
||||
# from SparseSC.optimizers.cd_line_search import cdl_search
|
||||
import numpy as np
|
||||
|
||||
def L2_pen_guestimate(X):
|
|
@ -1,6 +1,6 @@
|
|||
#from RidgeSC.fit_fold import fold_v_matrix
|
||||
from RidgeSC.fit_loo import loo_v_matrix
|
||||
from RidgeSC.fit_ct import ct_v_matrix
|
||||
#from SparseSC.fit_fold import fold_v_matrix
|
||||
from SparseSC.fit_loo import loo_v_matrix
|
||||
from SparseSC.fit_ct import ct_v_matrix
|
||||
import numpy as np
|
||||
|
||||
def tensor(X, Y, X_treat=None, Y_treat=None, **kwargs):
|
|
@ -1,7 +1,7 @@
|
|||
import unittest
|
||||
import numpy as np
|
||||
import random
|
||||
import RidgeSC as SC
|
||||
import SparseSC as SC
|
||||
|
||||
def ge_dgp(N0,N1,T0,T1,K,S,R,groups,group_scale,beta_scale,confounders_scale,model= "full"):
|
||||
"""
|
|
@ -1,5 +1,5 @@
|
|||
from RidgeSC.fit_loo import loo_weights
|
||||
from RidgeSC.fit_ct import ct_weights
|
||||
from SparseSC.fit_loo import loo_weights
|
||||
from SparseSC.fit_ct import ct_weights
|
||||
import numpy as np
|
||||
|
||||
def weights(X, X_treat=None, **kwargs):
|
16
docs/conf.py
16
docs/conf.py
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# RidgeSC documentation build configuration file, created by
|
||||
# SparseSC documentation build configuration file, created by
|
||||
# sphinx-quickstart on Thu Sep 27 14:53:55 2018.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
|
@ -51,7 +51,7 @@ source_suffix = ['.rst', '.md']
|
|||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'RidgeSC'
|
||||
project = 'SparseSC'
|
||||
copyright = '2018, Jason Thorpe, Brian Quistorff, Matt Goldman'
|
||||
author = 'Jason Thorpe, Brian Quistorff, Matt Goldman'
|
||||
|
||||
|
@ -59,7 +59,7 @@ author = 'Jason Thorpe, Brian Quistorff, Matt Goldman'
|
|||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
from RidgeSC import __version__
|
||||
from SparseSC import __version__
|
||||
version = __version__
|
||||
# The full version, including alpha/beta/rc tags. (For now, keep the same)
|
||||
release = version
|
||||
|
@ -137,7 +137,7 @@ source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser', }
|
|||
# -- Options for HTMLHelp output ------------------------------------------
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'RidgeSCdoc'
|
||||
htmlhelp_basename = 'SparseSCdoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
@ -164,7 +164,7 @@ latex_elements = {
|
|||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'RidgeSC.tex', 'RidgeSC Documentation',
|
||||
(master_doc, 'SparseSC.tex', 'SparseSC Documentation',
|
||||
'Jason Thorpe, Brian Quistorff, Matt Goldman', 'manual'),
|
||||
]
|
||||
|
||||
|
@ -174,7 +174,7 @@ latex_documents = [
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'ridgesc', 'RidgeSC Documentation',
|
||||
(master_doc, 'sparsesc', 'SparseSC Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
|
@ -185,8 +185,8 @@ man_pages = [
|
|||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'RidgeSC', 'RidgeSC Documentation',
|
||||
author, 'RidgeSC', 'One line description of project.',
|
||||
(master_doc, 'SparseSC', 'SparseSC Documentation',
|
||||
author, 'SparseSC', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
.. RidgeSC documentation master file, created by
|
||||
.. SparseSC documentation master file, created by
|
||||
sphinx-quickstart on Thu Sep 27 14:53:55 2018.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to RidgeSC's documentation!
|
||||
Welcome to SparseSC's documentation!
|
||||
===================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
build/apidoc/RidgeSC/RidgeSC
|
||||
build/apidoc/SparseSC/SparseSC
|
||||
|
||||
|
||||
Indices and tables
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
"""
|
||||
USAGE:
|
||||
|
||||
cd path/to/RidgeSC
|
||||
cd path/to/SparseSC
|
||||
python example-code.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.join(os.getcwd(),"RidgeSC"))
|
||||
#sys.path.append(os.path.join(os.getcwd(),"SparseSC"))
|
||||
|
||||
import time
|
||||
import RidgeSC as SC
|
||||
from RidgeSC.tests import ge_dgp
|
||||
import SparseSC as SC
|
||||
from SparseSC.tests import ge_dgp
|
||||
import numpy as np
|
||||
import random
|
||||
|
||||
|
|
8
makefile
8
makefile
|
@ -32,11 +32,11 @@ readmedocs:
|
|||
|
||||
pylint:
|
||||
-mkdir build
|
||||
pylint RidgeSC > build$(DIR_SEP)pylint_msgs.txt
|
||||
pylint SparseSC > build$(DIR_SEP)pylint_msgs.txt
|
||||
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = python -msphinx
|
||||
SPHINXPROJ = RidgeSC
|
||||
SPHINXPROJ = SparseSC
|
||||
SOURCEDIR = docs/
|
||||
BUILDDIR = docs/build
|
||||
SPHINXAPIDOC = sphinx-apidoc
|
||||
|
@ -46,6 +46,6 @@ BUILDAPIDOCDIR= docs$(DIR_SEP)build$(DIR_SEP)apidoc
|
|||
htmldocs:
|
||||
-$(RMDIR_CMD) $(BUILDDIRHTML)
|
||||
-$(RMDIR_CMD) $(BUILDAPIDOCDIR)
|
||||
$(SPHINXAPIDOC) -f -o $(BUILDAPIDOCDIR)/RidgeSC RidgeSC
|
||||
$(RM_CMD) $(BUILDAPIDOCDIR)$(DIR_SEP)RidgeSC$(DIR_SEP)modules.rst
|
||||
$(SPHINXAPIDOC) -f -o $(BUILDAPIDOCDIR)/SparseSC SparseSC
|
||||
$(RM_CMD) $(BUILDAPIDOCDIR)$(DIR_SEP)SparseSC$(DIR_SEP)modules.rst
|
||||
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
|
6
setup.py
6
setup.py
|
@ -19,11 +19,11 @@ def find_version(*file_paths):
|
|||
return version_match.group(1)
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
|
||||
setup(name="RidgeSC",
|
||||
version=find_version('RidgeSC', '__init__.py'),
|
||||
setup(name="SparseSC",
|
||||
version=find_version('SparseSC', '__init__.py'),
|
||||
description="Sparse Synthetic Controls",
|
||||
author="Microsoft Research",
|
||||
url="https://github.com/Microsoft/SparseSyntheticControls",
|
||||
packages=['RidgeSC'],
|
||||
packages=['SparseSC'],
|
||||
license='MIT',
|
||||
install_requires=["numpy", "Scipy", "scikit-learn"])
|
||||
|
|
Загрузка…
Ссылка в новой задаче