class: center, middle Elements of Data Science - F2019 # Prediction and Sklearn 10/6/2019 --- # Dimensions of ML
-- count:false - Interpretation vs Prediction -- count:false - Regression vs Classification -- count:false - Model Families --- # Dimensions of ML -- count:false ### Interpretation vs Prediction -- count:false - Do we care more about how X relates to y? -- count:false - Ex: What happens to tip size as taxi trip length increases? -- count:false - Ex:What is the relationship between debt and loan default? -- count:false -- count:false - Do we care more about generating predictions? -- count:false - Ex: For a given trip, what will the tip size likely be? -- count:false - Ex: For a given loan, will there be a default? --- # Dimensions of ML -- count:false ### Regression vs Classification -- count:false - Real valued labels -- count:false - Ex: For a given trip, what will the tip size likely be? -- count:false - Ex: For a given house, what is the price likely to be? -- count:false - Discrete categorical labels -- count:false - Ex: For a given type of wine, what is it's likely grade? -- count:false - Ex: For a given image patch, is there a face in it? --- # Dimensions of ML -- count:false ### Model Families -- count:false - Linear - LinearRegression/Logistic Regression/SVM -- count:false - Distance Based - K-Nearest Neighbor -- count:false - Tree Based - Decision Trees -- count:false - Probabilistic - Naive Bayes -- count:false - Network Based - Neural Networks --- # Dimensions of ML ### Other Dimensions -- count:false - Parametric vs. Non-Parametric - logistic regression vs. k-NN -- count:false - ??? --- # Regression And Classification -- count:false - **Regression** -> predict a real value (Ex. predict tip) -- count:false - **Classification** -> predict a discrete class, category -- count:false - **Binary** classification : two categories - pos/neg, cat/dog, win/lose -- count:false - **Multiclass** classification : more than two categories - red/green/blue, flower type, integer 0-10 -- count:false - **Multilabel** classification : can assign more than one label to an instance - paper topics, entities in image
-- count:false - can convert a regression problem into classification with binning/threshold --- # Intro to Prediction -- count:false - Given an item $x$, predict a value $\hat{y}$ -- count:false - often, $\hat{y} = \arg\max_y f(y,x)$ -- count:false - often less interested in why than in how well -- count:false - How well will model generalize? -- count:false - **Generalization**: - how well will model predict on data that it hasn't seen yet --- # Avoiding Overfitting/Underfitting -- count:false - **Overfitting**: poor generalization due to complexity - learning noise in training leading to poor generalization -- count:false - Never train and evaluate on the same set of data! - train test split - cross-validation -- count:false - Keep the model as simple as possible - Occam's Razor -- count:false - **Underfitting**: poor generalization due to simplicity --- # Regularization -- count:false - Use to avoid overfitting in linear models -- count:false - **Ridge** or $\ell_2$ - Try to keep coefficients small -- count:false - **LASSO** or $\ell_1$ - Try to drive coefficients to zero -- count:false - **ElasticNet** - Mixture of $\ell_1$ and $\ell_2$ - $\alpha\ell_1 + (1-\alpha)\ell_2$ --- # Modeling Libraries -- count:false - Interpretation - Statsmodels .center[![:scale 50%](images/statsmodels.png)] -- count:false - Prediction - scikit-learn - plus much more! .center[![:scale 30%](images/sklearn.png)] --- # Sklearn Standard Usage -- count:false ```python from sklearn import Model # import the model ``` -- count:false ```python model = Model() # instantiate and set any hyperparameters ``` -- count:false ```python model.fit(X,y) # fit/train the model on the data ``` -- count:false ```python yhat = model.predict(X) # generate predictions using trained model ``` -- count:false ```python yhat = model.score(y,yhat) # measure model performance ``` -- count:false ```python X_new = model.transform(X) # transform data ``` --- # Aside: Mlxtend and conda-forge -- count:false .small[ > Mlxtend (machine learning extensions) is a Python library of useful tools for the day-to-day data science tasks.] .center[ ![:scale 10%](images/mlxtend.png)] -- count:false .small[ > A community-led collection of recipes, build infrastructure and distributions for the conda package manager.] .center[![:scale 10%](images/conda_forge.png)] -- count:false ```bash $ conda install --name eods-f19 --channel conda-forge mlxtend ``` --- # Example: Wine .smallest[ ```python from sklearn import datasets wine = datasets.load_wine() X = pd.DataFrame(wine.data,columns=wine.feature_names) y = wine.target ```] .smallest[ ```python # keep only class 0 and 1 and two columns of X and standardize X features = wine.feature_names[3:5] X = X.iloc[y < 2,3:5].apply(lambda x: (x-x.mean())/x.std()).values y = y[y < 2] X.shape,y.shape ```] .smallest[ ``` ((130, 2), (130,)) ```] .smallest[ ```python features ```] .smallest[ ``` ['alcalinity_of_ash', 'magnesium'] ``` ] --- # Example: Wine .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(8,8)) sns.scatterplot(X[y==0,0],X[y==0,1],label='class 0',marker='s',s=80); sns.scatterplot(X[y==1,0],X[y==1,1],label='class 1',marker='^',s=80); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[ ![](images/wine_2class.png)] --- # Logistic Regression > Use a squashing function on a linear regression to get a classification -- count:false ```python from sklearn.linear_model import LogisticRegression lr = LogisticRegression() lr.fit(X,y) ``` .smaller[ ``` LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True, intercept_scaling=1, l1_ratio=None, max_iter=100, multi_class='warn', n_jobs=None, penalty='l2', random_state=None, solver='warn', tol=0.0001, verbose=0, warm_start=False) ``` ] --- # Logistic Regression -- count:false .smallest[ ```python from mlxtend.plotting import plot_decision_regions ```] -- count:false .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=lr, legend=2); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] -- count:false .center[![](images/wine_2class_lr.png)] --- # Logistic Regression ### Pros and Cons of Logistic Regression -- count:false - interpretable -- count:false - sensitive to scaling of variables -- count:false - sensitive to colinearity -- count:false - need to deal with categorical variables -- count:false ###Need to choose - regularization --- # Support Vector Machine > Find the line/plane that separates our classes with the largest margin
-- count:false .center[ ![](images/svm-separating-lines.png) ] --- # Support Vector Machine > Find the line/plane that separates our classes with the largest margin
.center[ ![](images/svm-optimal-hyperplane.png) ] --- # Support Vector Machine ```python from sklearn.svm import SVC svc = SVC() svc.fit(X,y) ``` ``` SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, decision_function_shape='ovr', degree=3, gamma='auto_deprecated', kernel='rbf', max_iter=-1, probability=False, random_state=None, shrinking=True, tol=0.001, verbose=False) ``` --- # Support Vector Machine .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=svc); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[![](images/wine_2class_svm.png)] --- # Support Vector Machine ###Pros and Cons of SVM -- count:false - slow to learn -- count:false - fast to evaluate -- count:false - can use kernel trick to learn non-linear functions -- count:false ###Need to choose - kernel - penalty on error term --- # k-Nearest Neighbor > What category do most of the $k$ nearest neighbors belong to
-- count:false .center[![](images/KnnClassification.svg.png)] --- # k-Nearest Neighbor ```python from sklearn.neighbors import KNeighborsClassifier knn = KNeighborsClassifier() knn.fit(X,y) ``` ``` KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski', metric_params=None, n_jobs=None, n_neighbors=5, p=2, weights='uniform') ``` --- #k-Nearest Neighbor .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=knn); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[![](images/wine_2class_knn.png)] --- #k-Nearest Neighbor ###Pros and Cons of kNN -- count:false - fast to train -- count:false - potentially slow to predict -- count:false - need to deal with categorical variables -- count:false - curse of dimensionality -- count:false ###Need to choose - number of neighbors - distance function --- # Decision Tree > If we ask a bunch of yes no questions, what answers do we see? .center[![:scale 50%](images/iris_decision_tree.svg)] --- # Decision Tree ```python from sklearn.tree import DecisionTreeClassifier dtc = DecisionTreeClassifier() dtc.fit(X,y) ``` ``` DecisionTreeClassifier(class_weight=None, criterion='gini', max_depth=None, max_features=None, max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, min_samples_leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, presort=False, random_state=None, splitter='best') ``` --- # Decision Tree .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=dtc); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[![](images/wine_2class_dt.png)] --- # Decision Tree ###Pros and Cons of Decision Trees - very interpretable - tendency to overfit -- count:false ###Need to choose - criteria to choose feature split --- # Decision Tree .smallest[ ```python sklearn.tree.plot_decision_tree() ```] ![](images/wine_2class_plotdecisiontree.png) --- # Naive Bayes -- count:false - Using Bayes rule .center[ $P(y|x\_1,\ldots,x\_m) = \frac{P(x\_1,\ldots,x\_m|y)P(y)}{P(x\_1,\ldots,x\_m)}$] -- count:false - Assume conditional independence of features given label .center[ $P(x\_i|y,x\_1,\ldots,x\_{i-1},x\_{i+1},\ldots,x\_m) = P(x\_i|y)$] -- count:false - And since the denominator is the same across label y, we get .center[ $\hat{y} = \arg\max\_y P(y) \prod\_{i=1}^n P(x\_i|y)$] --- # Naive Bayes -- count:false - Easy when x's are counts - Multinomial Naive Bayes - assumes multinomial distribution for each label -- count:false - Can also be used when x is real valued - Gaussian Naive Bayes - assumes gaussian distribution for each label --- # Naive Bayes .smaller[ ```python from sklearn.naive_bayes import GaussianNB gnb = GaussianNB() gnb.fit(X,y) ```] .smaller[ ``` GaussianNB(priors=None, var_smoothing=1e-09) ```] --- # Naive Bayes .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=gnb); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[![](images/wine_2class_gnb.png)] --- # Naive Bayes ### Pros and Cons of Naive Bayes - simple - depends on strong independence assumption - depends on strong assumption of data distributions - data scarcity (when learning) -- count:false ###Need to choose - distribution for x --- # Neural Network ### Perceptron .center[![:scale 60%](images/perceptron.png)] --- # Neural Network .center[![:scale 90%](images/multi_layer_perceptron.png)] --- # Neural Network .smaller[ ```python from sklearn.neural_network import MLPClassifier mlp = MLPClassifier() mlp.fit(X,y) ```] .smaller[``` MLPClassifier(activation='relu', alpha=0.0001, batch_size='auto', beta_1=0.9, beta_2=0.999, early_stopping=False, epsilon=1e-08, hidden_layer_sizes=(100,), learning_rate='constant', learning_rate_init=0.001, max_iter=200, momentum=0.9, n_iter_no_change=10, nesterovs_momentum=True, power_t=0.5, random_state=None, shuffle=True, solver='adam', tol=0.0001, validation_fraction=0.1, verbose=False, warm_start=False) ```] --- # Neural Network .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=mlp); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[![](images/wine_2class_mlp.png)] --- # Neural Network ###Pros and Cons of Deep Learning - highly uninterpretable - can learn complex interactions - perform well on tasks involving complex signals (eg interactions of layered factors) -- count:false ###Need to choose - layers - activation function - learning rate - ... --- # Ensembles -- count:false - Wisdom of the crowd -- count:false - Can often achieve better performance with collection of learners -- count:false - Often use shallow trees as base learners -- count:false ###Common Methods for generating ensembles: -- count:false - Bagging (Bootstrap Aggregation) - Random Forest -- count:false - Boosting - Gradient Boosting -- count:false - Stacking --- # Random Forest And GradientBoost .center[![:scale 80%](images/Architecture-of-the-random-forest-model.png)] --- # Random Forest - Trees built with bootstrap sample and subsets of features - Variation with random selection of features (and samples) .smaller[ ```python from sklearn.ensemble import RandomForestClassifier rfc = RandomForestClassifier() rfc.fit(X,y) ```] .smaller[ ``` RandomForestClassifier(bootstrap=True, class_weight=None, criterion='gini', max_depth=None, max_features='auto', max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, min_samples_leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, n_estimators=10, n_jobs=None, oob_score=False, random_state=None, verbose=0, warm_start=False) ```] --- # Random Forest .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=rfc); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[![](images/wine_2class_rfc.png)] --- # Random Forest -- count:false ###Pros and Cons of Gradient Boosting - less likely to overfit than decision tree - quick to predict, quick to train -- count:false ###Need to choose - number of trees - number of features per tree --- # Gradient Boosting - Trees built by adding weight to errors - Variation due to changes in weights on observations .smaller[ ```python from sklearn.ensemble import GradientBoostingClassifier gbc = GradientBoostingClassifier() gbc.fit(X,y) ```] .smaller[ ``` GradientBoostingClassifier(criterion='friedman_mse', init=None, learning_rate=0.1, loss='deviance', max_depth=3, max_features=None, max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, min_samples_leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, n_estimators=100, n_iter_no_change=None, presort='auto', random_state=None, subsample=1.0, tol=0.0001, validation_fraction=0.1, verbose=0, warm_start=False) ```] --- # Gradient Boosting .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=gbc); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[![](images/wine_2class_gbc.png)] --- # Gradient Boosting -- count:false ###Pros and Cons of Gradient Boosting - pays more attention to difficult regions - quick to predict, slow to train - tends to work well -- count:false ###Need to choose - number of trees - max-depth --- # Stacking .center[![](images/modelstacking.png)] .smallest[ From https://blogs.sas.com/content/subconsciousmusings/2017/05/18/stacked-ensemble-models-win-data-science-competitions/] --- # Stacking .smallest[ ```python from mlxtend.classifier import StackingClassifier ensemble = [LogisticRegression(),GaussianNB(),KNeighborsClassifier()] stc = StackingClassifier(ensemble,LogisticRegression()) stc.fit(X,y) ```] .smallest[ ``` StackingClassifier(average_probas=False, classifiers=[LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True, intercept_scaling=1, l1_ratio=None, max_iter=100, multi_class='warn', n_jobs=None, penalty='l2', random_state=None, solver='warn', tol=0.0001, verbose=0, warm_start=False), GaussianNB(priors=None, var_smoothing=1e-09), KNeighborsClassifi...] meta_classifier=LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True, intercept_scaling=1, l1_ratio=None, max_iter=100, multi_class='warn', n_jobs=None, penalty='l2', random_state=None, solver='warn', tol=0.0001, verbose=0, warm_start=False), store_train_meta_features=False, use_clones=True, use_features_in_secondary=False, use_probas=False, verbose=0) ```]] --- # Stacking .smallest[ ```python fig,ax = plt.subplots(1,1,figsize=(6,6)) plot_decision_regions(X, y, clf=stc); plt.xlabel(features[0]); plt.ylabel(features[1]); ```] .center[![](images/wine_2class_stc.png)] --- # Stacking -- count:false ###Pros and Cons of Stacking - combines benefits of multiple learning types - easy to implement - tends to win competitions -- count:false ###Need to choose - member learners - meta-learner --- # But which model is best? - For classification, .score defaults to accuracy: $\frac{TP + TN}{n}$ -- count:false .smaller[ ```python print(f'lr : {lr.score(X,y):.2f}') ... ```] .smaller[ ``` *lr : 0.81 svc: 0.85 knn: 0.87 *dtc: 0.98 mlp: 0.83 rfc: 0.96 gbc: 0.97 stc: 0.87 ```] -- count:false What are we doing wrong here? --- # But which model is best? - Using train_test_split .smaller[ ```python print(f'lr : {LogisticRegression().fit(X_train,y_train).score(X_test,y_test):.2f}') ... ```] -- count:false .smaller[ ``` *lr : 1.00 svc: 0.92 knn: 0.92 *dtc: 0.62 mlp: 0.92 rfc: 0.77 gbc: 0.77 stc: 0.92 ```] -- count:false **Next : Model Evaluation and Selection** --- class:middle # Questions?


#include <Box2D/Common/b2Math.h>
Go to the source code of this file.
Classes | |
| struct | b2Jacobian |
| struct | b2JointEdge |
| struct | b2JointDef |
| Joint definitions are used to construct joints. More... | |
| class | b2Joint |
Enumerations | |
| enum | b2JointType { e_unknownJoint, e_revoluteJoint, e_prismaticJoint, e_distanceJoint, e_pulleyJoint, e_mouseJoint, e_gearJoint, e_lineJoint, e_weldJoint, e_frictionJoint } |
| enum | b2LimitState { e_inactiveLimit, e_atLowerLimit, e_atUpperLimit, e_equalLimits } |
| enum b2JointType |
| enum b2LimitState |


$def with (user_name, points, account, account_cache, num_cache, num_user, node_info, rank, n_nodes, video_owned)
In this dashboard you can 1) View VoD leaderboard; 2) check incentive points earned; 3) review data usage and movie watching history & wish list;
There are $n_nodes[1] cache(s) and $n_nodes[2] user(s) running in the system
You are running $num_cache cache and $num_user user (listed below)
| type | user_name | watching_video |
|---|---|---|
| $n |
| type | ip | port | bytes_uploaded | size |
|---|---|---|---|---|
| $c |
You've watched $points[1] movies, and uploaded $points[2] Mbs
(For each 1 GB of data you shared, you are rewarded 1 point. 5 points will be subtracted each time you watch a new movie. No further points will be subtracted if you re-watch a movie)
| user_name | movie_watched | Mbs_uploaded |
|---|---|---|
| $u |


http://localhost:[PORT]/[YOUR-WEBAPP]/dwr/index.html
to check that your spring beans appear.Spring 2.x includes a new feature named XML Namespace Handlers. This allows DWR and Spring MVC to remote Spring beans easily with a custom syntax.
If you're not using the MVC module, you can still leverage the namespace by mapping an org.directwebremoting.spring.DwrSpringServlet in your web.xml.
<servlet> <servlet-name>dwr</servlet-name> <servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>dwr</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping>
The first task you need to accomplish is adding the following lines (in bold, bellow) to any of your Spring XML files that includes at least one DWR specific tag. Add them inside the beans
declaration (at the beginning of the file):
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">
Once you have added the namespace declaration any modern IDE (NetBeans, Eclipse, Idea) will automatically help you to write the tags with its code completion features.
You must declare one <dwr:configuration>
tag. This tag is mandatory even if empty. It may have nested tags (init, creator, signatures,..). These nested tags mimic the behavior of those available in dwr.xml. Understand their functioning first and then use your IDE to translate to the correct syntax.
Again you must declare one <dwr:controller id="dwrController" debug="true" />
tag. This tag does not allow inner tags. In Spring MVC, for each controller you have to map the URLs that it will handle. The simplest way is probably declaring a SimpleUrlHandlerMapping. DWR needs mappings for the following URLs: /engine.js, /interface.js, /call/**, /interface/**
. Remember that a DWR Controller is just needed (and useful) in Spring MVC environments (use the servlet in other cases) and this way you get the number of other related Spring services (ie localization).
Inside each bean you want to remote include a <dwr:remote javascript="Fred">
tag. There you can specify the methods that are going to be proxied and those that won't. For example:<bean id="timeConvert" class="com.mycompany.ui.util.TimeConvert">
<dwr:remote javascript="AjaxTimeConvert">
<dwr:include method="convert" />
</dwr:remote>
</bean>
One of the common pitfalls when integrating Spring and DWR are scoped beans (session, request, ...). In practice is easy to get them going, just remember two basic rules.
<aop:scoped-proxy proxy-target-class="false" />
in the bean declarationHere's an example:
<bean id="calc" class="...CalculatorImpl" scope=session>
<dwr:remote javascript="Calculator">
<dwr:include method="add"/>
</dwr:remote>
<aop:scoped-proxy proxy-target-class="false" />
</bean>
If you're receiving the dreaded object is not an instance of declaring class
error always check these things:
<aop:aspectj-autoproxy proxy-target-class="false" />
in your Spring XML<aop:scoped-proxy />
This kind of integration has been discussed in depth some times by now. Try reading:
New configuration options are already committed in CVS. They're available today for those who like living on the edge (development). The most important are the automatic mapping of URLs (<dwr:url-mapping />
)and the use of annotations to remote Spring beans (<dwr:annotation-config />
). As you can see, they make even further use of the namespace feature. They will be properly documented here with the new release. This new features require Spring 2.5 at least.
If you feel comfortable using dwr.xml, you may use the Spring creator. This creator will lookup beans in your Spring <beans>.xml file and rely on Spring to instantiate them. This creator will be useful to you if you already use Spring and totally useless if you don't.
You allow DWR to use the spring creator to create and remote your beans as follows:
<allow> ... <create creator="spring" javascript="Fred"> <param name="beanName" value="Shiela"/> </create> ... </allow>
There are several ways to find your spring configuration files:
<allow> ... <create creator="spring" javascript="Fred"> <param name="beanName" value="Shiela"/> <param name=location value="beans.xml"/> </create> ... </allow>
setOverrideBeanFactory(BeanFactory)
method that provides a way to programatically override any BeanFactories found by other means (if any).Please, take into account that not all methods are equally easy in practice. Probably, unless you know what you're doing you're better served using one of the first two.


---
layout: post
title: Are Your Abusing Constructors, Too?
tags:
- code
- constructor
- organization
- Theory
status: publish
type: post
published: true
meta:
_edit_last: '1'
_clicky_goal: a:2:{s:2:"id";s:0:"";s:5:"value";s:0:"";}
---
Ah, constructors. The little, forgotten, and often abused thing. No one really thinks about it for long, no one really knows what it does. Everyone tends to ignore it until they think they need it and throws things into it with no care whatsoever. Yes, the constructor might be the best equivalent to a homeless child.
And yet, recently, I started thinking more and more about homeless children constructors. They are a defining character of all object-oriented programming languages. And they do fulfill an important role! So let's learn a bit more about the homeless constructor.
Do's in a Constructor
Ever had a class that felt awkward to use? Where you, in practically ever method, first checked if some precondition was fulfilled? That might mean you have forgotten to put something in a constructor.
The simple rule is: Everything the class needs in order to work goes into the constructor. For example, recently I wrote a small proxy to Nokogiri. The class looked something like this:
class XmlHelper
def open(file)
@file = Nokogiri::XML(file)
end
def find_uas
raise 'Open the file first' unless @file
# read file etc.
end
end
With one method, that might work. But how would I add a second method here? I would have to do the same check if the file is actually opened again. Which means the class isn't ready for operation after the constructor is called! So I fixed this the easy (but hey, stylish!) way:
class XmlHelper
def initialize(file)
@file = Nokogiri::XML(file)
end
def find_uas
raise 'Open the file first' unless @file
# read file etc.
end
end
Yes, one small change. From now on, when someone wants to make an instance of XmlHelper, he has to provide a file to read. Which means the class is ready to be used.
Put things into the constructor if the class can't feasibly be used without it.
Another great use of constructors? Dependencies! Of course, you could add a dependency like that:
class Limb
@child = Child.new
end
We have two problems with this:
- The Limb class knows too much about its surroundings. Maybe it just needs to tell the child that it is tired. But what if we suddenly want to use the Limb class with an Adult? A dog? We can't do that with this implementation!
- Another problem is testing. We can't, in a unit test, easily replace Child with a mock or a stub. Maybe instantiation of a child is difficult (it takes 9 months for gods sake!) Or we simply want to test the interaction between Limb and Child, which is difficult if we don't know to which Child this Limb is talking to. (Remember: A constructor shouldn't do real work!)
The better way to do it?
class Limb
def initialize(body)
@body = body
end
end
Ah, now it's obvious, right? We can simply add a new body that this Limb belongs to. And the Limb doesn't care anymore if it is a child or not. For the lazy who don't want to type Limb.new(child) all the time, we can also change the initialize call to def initialize(body = Child.new) ... end so the Child is automatically added if we don't specify something else.
But Don't Put These Things Into the Constructor!
So now that we have a usable object after construction, what doesn't belong in there? Should we just throw everything into there?
Now that we know what to throw into a constructor, it is easy what not to throw into a constructor. In short: Everything else. If not every method in the class needs this property, if the class doesn't need this information to work correctly, then don't add it to the constructor! If some methods need a property, and the others don't, you probably should split the class up into two. They deal with different things.
One special thing though: If the initialization logic is very complex, it might be better to put it into a builder. A builder is a separate object that can be used to build up an object. It can even build objects of different classes (that have the same method, of course) given different input.
Ah, So That's Constructors!
Yes, so it is. So please stop abusing the little homeless kid on the block and treat it with the kindness it deserves. It shouldn't be dropped all responsibilities, but don't forget that it is there and you can use it.
To summarize: Pass a constructor all the information the class needs to work properly, but nothing more.
Have I forgotten some use case for constructors? Do you know some other constructor abuse cases? Then drop a line either here in the comments or on Twitter!
If you liked this post, you should consider hiring me freelance, part-time or full-time!


Can act as a RichFile type interface too, adding a number of extra helper methods to make Files more rich
Represents a lazily loaded property
A Logging trait you can mix into an implementation class without affecting its public API
Represents a string, file or URI based resource
A strategy for loading Resource instances
Represents a source map (SMAP), which serves to associate lines of the input JSP file(s) to lines in the generated servlet in the final .
Not all resources are writeable so this optional trait is for those
Some helper methods for calling from Java
Helper object for working with objects using reflection
Helper methods to create a org.fusesource.scalate.support.Resource from various sources
A collection of helper methods
Helpers that aid with Scala soruce code generation.
Conversion from Java to Scala broke something.
Some helper methods for working with URIs and query strings


I love writing software that make me happy.
Here are some technologies i enjoy writing
Contact me on<PHONE_NUMBER> or drop me an email on<EMAIL_ADDRESS>For More info visit My Linkedin


PROJECTS
of the MCC of OGS
Each year the Monroe County Chapter of Ohio
Genealogical Society undertakes a number of projects for the purpose of
expanding the resources available to members and visitors of the Chapter. These
include projects such as collecting data from inaccessible resources to be
available in tabular or other convenient forms. Other projects involve making a
complete inventory of all Monroe County cemeteries. Still others include hard
binding important documents and books. The fruits of these projects are freely
available to our members and visitors.
The majority of the projects undertaken by
the MCC of OGS are done by volunteers most of whom are Chapter members. There
is a backlog of important projects that could be undertaken if only we had more
volunteers to help. If you have an interest in taking the lead for, working on,
or just assisting on any of these projects or if you have a project that you
feel should be accomplished, please contact our MCC of OGS president to
volunteer.
Projects currently being undertaken
[This document is currently under
construction. When complete, it will include click-able links to the subject of
interest.]
Inventory of Monroe County cemeteries (Also see Cemeteries)
Maintaining MCC of OGS web site
Hard-binding several of the library documents
Transfer to electronic media, Monroe County births, deaths, marriages
Preserving and publication of church records in Monroe County
Computerize contents of genealogy library
Early Marriage Records of Monroe County, Ohio
Researchers Needed to perform Monroe County Research
Candidates for new projects
Generate computerized, searchable genealogy
library databases
Click here for the Short-Cut Table of Contents


--- layout: archive title: Zulip Chat Archive permalink: /stream/116395-maths/topic/.60simp.60.20lemmas.20for.20.60matrix.2Emul.60.20vs.20.60has_mul.2Emul.60.html ---
The simp
lemma matrix.mul_eq_mul : M * N = matrix.mul M N
seems to imply that the canonical representation for matrix multiplication is matrix.mul
. I'm seeing a lot of simp
lemmas using has_mul.mul
, e.g. matrix.det_mul : det (M * N) = det M * det N
. Is there a reason for this, or should I standardise these lemmas to use matrix.mul
?
Good question.
I'm not sure if I like it that matrix.mul
is the standard simp form. For square matrices M * N
is certainly better, because it unlocks a boatload of simp-lemmas from algebra.
On the other hand, a lot of these lemmas (I estimate from quickly looking over some relevant files) will hold for rectangular matrices as well, so duplication seems unavoidable either way.
I guess the true generalisation will be to state everything in terms of composition of morphisms in a category, which has its own API problems...
Doesn't has_mul.mul
force the matrices to be the same size (and therefore square)?
It does.
So having simp turn matrix.mul
to *
, which could only fire for square matrices, wouldn't be a good idea. If A is m x m and B is m x m and C is m x n then (A.mul B).mul C = A.mul (B.mul C)
might first turn A.mul B
into A * B
, then get stuck unless there is a simp lemma for (A * B).mul C
.
So maybe we shouldn't have a simp lemma in either direction, and let the user decide.
You want to use commute
or something but simp
is messing up your *
?
The specific motivation for the question was that I want to define a few extra simp
lemmas and was unsure how to state them, but I've encountered before that matrix.det_mul
didn't fire because matrix.mul_eq_mul
removed the *
s.
Since the discussion petered out with only the conclusion that rewriting matrix.mul
to has_mul
is not what we want, I've made a PR with the changes I suggested.
Last updated: Apr 24 2020 at 19:02 UTC


--- layout: "blog_layout" web_title: "Tkinter Geometry Manager - The Grid method" page_title: "Tkinter Geometry Manager - The Grid method" video_link: "aHaPr8WWd60" upload-date: "April 13, 2018" author: "Harsh Patel" ---
The grid pack method is one of the useful method , when you take into consideration the part where you need to design or place the widgets column wise or row wise. The placing of widgets in such a way is easier, since you do not have to mention the co-ordinates of widgets every time. The grid method mainly takes two arguments i.e row and column value. Upon specifying the row and column values we can see that


Legit.ng had earlier reported that Chioma had shared a video of herself bottle-feeding her newborn baby boy, Ifeanyi David Adeleke Junior. In the video, the mother and son were listening to track from Davido's recently released album, A Good Time.
After Chioma shared the video, Nigerians commented under the post, some congratulated her and gushed about the mother and son while others took it upon themselves to share advice.
PAY ATTENTION: Read best news on Nigeria's #1 news app
They told the new mom to stop bottle-feeding her baby and feed him the natural way in other to create the mother and son bond.
Chioma replied to the comment, stating that she does both but when others believed they had more to say, she gave them a curt reply, asking them to leave her alone.
PAY ATTENTION: Do you have news to share? Contact Legit.ng instantly
READ ALSO: NAIJ.com upgrades to Legit.ng: a letter from our Editor-in-Chief Bayo Olupohunda
Meanwhile, Legit.ng had earlier reported that the latest celebrity mother in town recently took to her social media page to share some parts of her motherhood journey with fans. Chioma revealed that she actually produces a lot of breast milk to feed her son.
Male nurse helps pregnant woman deliver her baby inside a tricycle in Lagos (photos)
NAIJ.com (naija.ng) -> Legit.ng We have upgraded to serve you better
Nigeria News Davido & Chioma: All You Want To Know About Their Latest Photoshoot - on Legit TV


{% load static %}
WElCOME TO THE FACULTY OF COMPUTERS AND INFORMATICS
.COMMITTED TO CREATING A BRIGHTER WORLD
About
Study At FCI
News & Events
Student ServiceS
Logout
Suez Canal University COVID-19 CORONA VIRUS GUIDANCE
More Information
News
Student Activities
Virtual Tour
Admission
Open Day


`Paths` is an internal collection for tracking path strings.
Relative paths added to this array are expanded relative to `@root`.
paths = Paths.new("/usr/local") paths << "tmp" paths << "/tmp" paths # => ["/usr/local/tmp", "/tmp"]
# File lib/hike/paths.rb, line 21 def normalize_element(path) path = Pathname.new(path) path = @root.join(path) if path.relative? path.expand_path.to_s end
Generated with the Darkfish Rdoc Generator 2.


Microsoft To Do for Android gets updated with new features
by RakaMicrosoft’s task management app for Android, famously known as Microsoft To Do has received an update. The update brings a couple of new features and a lot of bug fixes.
With the latest update installed, you will be able to see things like due date, which lists a task belong to and also, whether you’ve added it to My Day. Moreover, if you switch to Dark Mode, you’ll notice a change in the colors of the icons. Taking the app to Version 2.4.136, the update brings plenty of bug fixes and performance improvements. You can see the official changelog below.
Changelog
• We’ll now show you more metadata in the widget, so you can see the due date, which list it belongs to and whether you’ve added it to My Day.
• We’ve changed the colors for the icons when you’re in dark mode.
• We made a lot of accessibility fixes and small improvements.
You can download Microsoft To Do app for your Android smartphones from the below link, or you can head over to Google Play Store.
|
|
Download | Microsoft To Do: List, Task & Reminder Developer: Microsoft Corporation Price: Free |
|


无与伦比
Hugo简介，围绕创造网站的又一新思路，Hugo轻松支持多种格式，是创建博客，文档，企业网站，作品展等等的理想工具。 Hugo 神迹般创建网站，给你带来更多乐趣。
跨平台运行
Hugo也许是你安装过最简单的软件，绿色安全，只需下载运行 Hugo不依赖于管理员权限，数据库，运行时环境，语言，外部库。 Hugo创建网站可以发布到S3 S3, GitHub Pages, Dropbox 或者其他任意服务器.
极速 & 强大
Hugo在意编译速度和性能，已采取大量措施已确保快速高效创建网站，我们正在讨论毫秒级创建完整网站的大部分设置。
灵活
Hugo 为你如何使用而进行设计的。 你想要的任何URL格式的内容。 定义属于你自己的内容格式。 基于YAML, TOML or JSON 完全定义属于你自己的元数据。 可检索分类你任何想要的内容。 最棒的是你几乎没有任何配置，Hugo就可以使用起来。
Hugo is super-rad.
— David Gay (@oddshocks) November 25, 2013
I had a play with Hugo and it was good, uses Markdown files for content
— David Caunt (@dcaunt) November 29, 2013
Even as a long-time Octopress fan, I’ve gotta admit that this project Hugo looks very very cool
— Douglas Stephen (@DougStephenJr) August 5, 2013
A static site generator without the long build times? Yes, please!
— Josh Matz (@joshmatz) August 5, 2013
Finally someone builds me my own static site generator
— Hugo Rodger-Brown (@hugorodgerbrown) August 5, 2013
I’m loving the static site generator renaissance we are currently enjoying. Hugo is new, looks great, written in Go
— Jim Biancolo (@jimbiancolo) December 5, 2013
Good work on Hugo, I’m impressed with the speed!
— Ludovic Chabant (@ludovicchabant) December 6, 2013
Checking out Hugo; Loving it so far. Like Jekyll but not so blog-oriented and written in go
— Jose Gonzalvo (@jgonzalvo) December 4, 2013
Building a personal website in Hugo. Works like a charm. And written in @golang!
— Jip J. Dekker (@jipjdekker) December 19, 2013
I love Hugo! My site is generated with it now http://rjrbt.io
— Nathan Toups (@rojoroboto) January 15, 2014
this is AWESOME. a single little executable and so fast.
— Luke Holder (@lukeholder) February 3, 2014
OK, so in today's speed battle of static site generators, @spf13's hugo is kicking everyone's ass, by miles.
— Kieran Healy (@kjhealy) February 22, 2014
I think I'm going to level up and try @spf13 's Hugo for my next project.
Dave Cheney (@davecheney ) March 24, 2014
I just fell in love with #hugo, a static site/blog engine written by @spf13 in #golang + stellar docs
— Dave Cottlehuber (@dch__) April 26, 2014
Another site generated with Hugo here! I'm getting in love with it.
— Javier Segura (@jsegura) May 12, 2014
One more satisfied #Hugo blogger. Thanks @spf13 and friends!
— Michael Whatcott (@mdwhatcott) May 23, 2014
The dev version of Hugo is AWESOME! <3 I promise, I will try to learn go ASAP and help contribute to the project! Just too great!
— Diti (@DitiPengi) May 30, 2014
#Hugo is the new @jekyllrb / @middlemanapp! Faster, easier and runs everywhere.
— Ruben Solvang (@messo85) May 31, 2014
Jekyll is dead to me these days though... long live Hugo! Hugo is *by far* the best in its field. Thanks for making it happen.
— The Lone Cuber (@TheLoneCuber) August 2, 2014
Finally, a publishing platform that's a joy to use. #NoMoreBarriers
— The Lone Cuber (@TheLoneCuber) August 2, 2014
Hugo: Makes the Web Fun Again
— mercime (@mercime_one) August 16, 2014
Hugo is fast, dead simple to setup and well documented
— Markus Eliasson (@markuseliasson) August 19, 2014
Finally the answer to the question my parents have been asking: What does Hugo do?
— Hugo Roy (@hugoroyd) August 19, 2014
Also, I re-launched my blog (it looks the same as before) using Hugo, a *fast* static engine. Very happy with it. gohugo.io
— Ryan Martinsen (@popthestack) December 30, 2014
I migrated the @BlackOpsTesting.com website from docpad to Hugo last weekend. http://gohugo.io/ Super Fast HTML Generation @spf13
— Alan Richardson (@eviltester) January 9, 2015
Hugo is impressively capable. It's a static site generator by @spf13 written in #golang. Just upgraded to latest release; very powerful.
— Baron Schwartz (@xaprb) January 18, 2015
#Hugo A very good alternative for #wordpress!!! A fast and modern static website engine gohugo.io
— WorkHTML (@workhtml) February 4, 2015


Brian Herrien, Jake Fromm Said A Prayer For The Injured Photographer During Halftime
by Matt LombardiJust before halftime of the Auburn-Georgia game, we had a scary situation at Jordan-Hare Stadium. Bulldogs running back Brian Herrien, after a short pass, we pushed out of bounds into a Georgia student photographer. She was knocked unconscious.
She came to a few minutes later, but needed to be carted off the field and taken by ambulance to the hospital. It looked like she was able to speak when leaving the stadium.
The woman has since been identified as Georgia student Chamberlain Smith. CBS Sports sideline reporter Jamie Erdahl provided an update on her situation.
Erdahl also noted that at halftime, Herrien and teammate Jake Fromm said a prayer in the locker room for Smith’s recovery.
Check it out:
We’ll keep you updated on Smith’s status. Hopefully she didn’t suffer any kind of serious injury.
Georgia, near the end of the third quarter, still holds a 14-0 lead. The Bulldogs can keep their hopes of a College Football Playoff berth with a win.


module List: BatList
type t'a
=list 'a
include BatEnum.Enumerable
include BatInterfaces.Mappable
let is_empty : list 'a => bool
is_empty e
returns true if e
does not contains any element.let cons : 'a => list 'a => list 'a
cons h t
returns the list starting with h
and continuing as t
let first : list 'a => 'a
Empty_list
if
the list is empty (similar to hd
).let hd : list 'a => 'a
first
, butFailure
if the list is empty.let tl : list 'a => list 'a
Failure
if the list is empty.let last : list 'a => 'a
Empty_list
if
the list is empty. This function takes linear time.let length : list 'a => int
let at : list 'a => int => 'a
at l n
returns the n-th element of the list l
orInvalid_argument
if the index is outside of l
bounds. O(l)let rev : list 'a => list 'a
let append : list 'a => list 'a => list 'a
@
.
Tail-recursive O(length of the first argument).let rev_append : list 'a => list 'a => list 'a
List.rev_append l1 l2
reverses l1
and concatenates it to l2
.let concat : list (list 'a) => list 'a
let flatten : list (list 'a) => list 'a
concat
.let singleton : 'a => list 'a
let make : int => 'a => list 'a
String.make
, make n x
returns a
list containing n
elements x
.let range : int => [< `Downto | `To ] => int => list int
range 1 `To 3
= [1; 2; 3]
.
range 3 `Downto 1
= [3; 2; 1]
.Invalid_argument
in (range i `To j
) if (i > j).Invalid_argument
in (range i `Downto j
) if (i < j).let init : int => (int => 'a) => list 'a
Array.init
, init n f
returns the list containing
the results of (f 0),(f 1).... (f (n-1)).Invalid_argument
if n < 0.let unfold : 'b => ('b => option ('a, 'b)) => list 'a
unfold init f
creates a list by repeatedly applying f
to the
second element of its own result, starting from the initial value
init
. The first element of each result is accumulated in
a list. The list is terminated and returned as soon as f
returns
None
.
Example: List.unfold 0 (fun x -> if x = 3 then None else Some (string_of_int x, x+1))
will return ["0";"1";"2"]
Since 2.1
let unfold_exc : (unit => 'a) => (list 'a, exn)
f()
. f()
is called repeatedly until it throws an exception.
Both the results list, as well as the exception
thrown are returned in a (results_list, exn)
pair.
Warning: if calls to f()
never throw an exception, unfold_exc
is an infinite loop.let iter : ('a => unit) => list 'a => unit
List.iter f [a0; a1; ...; an]
applies function f
in turn to
a0; a1; ...; an
. It is equivalent to
begin f a0; f a1; ...; f an; () end
.let iteri : (int => 'a => unit) => list 'a => unit
iteri f l
will call (f 0 a0); (f 1 a1) ... (f n an)
where
a0..an
are the elements of the list l
.let map : ('a => 'b) => list 'a => list 'b
map f [a0; a1; ...; an]
applies function f
to a0, a1, ..., an
,
and builds the list [f a0; f a1; ...; f an]
with the results returned by f
. Tail-recursive.let rev_map : ('a => 'b) => list 'a => list 'b
List.rev_map f l
gives the same result as
List.rev
(
List.map
f l)
.let mapi : (int => 'a => 'b) => list 'a => list 'b
mapi f l
will build the list containing
(f 0 a0); (f 1 a1) ... (f n an)
where a0..an
are the elements of
the list l
.let fold_left : ('a => 'b => 'a) => 'a => list 'b => 'a
List.fold_left f a [b0; b1; ...; bn]
is
f (... (f (f a b0) b1) ...) bn
.let fold_lefti : ('a => int => 'b => 'a) => 'a => list 'b => 'a
fold_left
, but with the index of the element, from 0
to
length li - 1
, as additional argument.let fold_right : ('a => 'b => 'b) => list 'a => 'b => 'b
List.fold_right f [a0; a1; ...; an] b
is
f a0 (f a1 (... (f an b) ...))
. Tail-recursive.let fold_righti : (int => 'b => 'a => 'a) => list 'b => 'a => 'a
fold_right
, but with the index of the element, from 0
to
length li - 1
, as additional argument.let reduce : ('a => 'a => 'a) => list 'a => 'a
List.reduce f h::t
is fold_left f h t
.Invalid_argument
on empty list.let max : list 'a => 'a
max l
returns the largest value in l
as judged by
Pervasives.compare
let min : list 'a => 'a
min l
returns the smallest value in l
as judged by
Pervasives.compare
let sum : list int => int
sum l
returns the sum of the integers of l
Invalid_argument
on the empty list.let fsum : list float => float
fsum l
returns the sum of the floats of l
Invalid_argument
on the empty list.let kahan_sum : list float => float
kahan_sum l
returns a numerically-accurate sum of the floats of
l
. See BatArray.fsum
for more details.let min_max : cmp::('a => 'a => int)? => list 'a => ('a, 'a)
min_max l
returns the pair (smallest, largest) from l
as judged by
Pervasives.compare
(by default). You can provide another
comparison function via the optional cmp
parameter.Invalid_argument
on an empty list.let iter2 : ('a => 'b => unit) => list 'a => list 'b => unit
List.iter2 f [a0; a1; ...; an] [b0; b1; ...; bn]
calls in turn
f a0 b0; f a1 b1; ...; f an bn
.Different_list_size
if the two lists have
different lengths.let map2 : ('a => 'b => 'c) => list 'a => list 'b => list 'c
List.map2 f [a0; a1; ...; an] [b0; b1; ...; bn]
is
[f a0 b0; f a1 b1; ...; f an bn]
.Different_list_size
if the two lists have
different lengths. Tail-recursive.let rev_map2 : ('a => 'b => 'c) => list 'a => list 'b => list 'c
List.rev_map2 f l1 l2
gives the same result as
List.rev
(
List.map2
f l1 l2)
, but is tail-recursive and
more efficient.let fold_left2 : ('a => 'b => 'c => 'a) => 'a => list 'b => list 'c => 'a
List.fold_left2 f a [b0; b1; ...; bn] [c0; c1; ...; cn]
is
f (... (f (f a b0 c0) b1 c1) ...) bn cn
.Different_list_size
if the two lists have
different lengths.let fold_right2 : ('a => 'b => 'c => 'c) => list 'a => list 'b => 'c => 'c
List.fold_right2 f [a0; a1; ...; an] [b0; b1; ...; bn] c
is
f a0 b0 (f a1 b1 (... (f an bn c) ...))
.Different_list_size
if the two lists have
different lengths. Tail-recursive.let mem : 'a => list 'a => bool
mem a l
is true if and only if a
is equal
to an element of l
.let mem_cmp : ('a => 'a => int) => 'a => list 'a => bool
List.mem
, but the comparator function is explicitely
provided.let memq : 'a => list 'a => bool
List.mem
, but uses physical equality instead of structural
equality to compare list elements.let for_all : ('a => bool) => list 'a => bool
for_all p [a0; a1; ...; an]
checks if all elements of the list
satisfy the predicate p
. That is, it returns
(p a0) && (p a1) && ... && (p an)
.let exists : ('a => bool) => list 'a => bool
exists p [a0; a1; ...; an]
checks if at least one element of
the list satisfies the predicate p
. That is, it returns
(p a0) || (p a1) || ... || (p an)
.let for_all2 : ('a => 'b => bool) => list 'a => list 'b => bool
List.for_all
, but for a two-argument predicate.Invalid_argument
if the two lists have
different lengths.let exists2 : ('a => 'b => bool) => list 'a => list 'b => bool
List.exists
, but for a two-argument predicate.Invalid_argument
if the two lists have
different lengths.let subset : ('a => 'b => int) => list 'a => list 'b => bool
subset cmp l l'
check if all elements of the list l
is contained in the list l'
by applying cmp
as comparator.let find : ('a => bool) => list 'a => 'a
find p l
returns the first element of the list l
that satisfies the predicate p
.Not_found
if there is no value that satisfies p
in the
list l
.let find_exn : ('a => bool) => exn => list 'a => 'a
find_exn p e l
returns the first element of l
such as p x
returns true
or raises e
if such an element has not been found.let findi : (int => 'a => bool) => list 'a => (int, 'a)
findi p e l
returns the first element ai
of l
along with its
index i
such that p i ai
is true, orNot_found
if no
such element has been found.let find_map : ('a => option 'b) => list 'a => 'b
find_map pred list
finds the first element of list
for which
pred element
returns Some r
. It returns r
immediately
once found orNot_found
if no element matches the
predicate. See also BatList.filter_map
.let rfind : ('a => bool) => list 'a => 'a
rfind p l
returns the last element x
of l
such as p x
returns
true
orNot_found
if such element as not been found.let filter : ('a => bool) => list 'a => list 'a
filter p l
returns all the elements of the list l
that satisfy the predicate p
. The order of the elements
in the input list is preserved.let filteri : (int => 'a => bool) => list 'a => list 'a
filter p [a0; a1; ...; an]
returns all the elements ai
of index i
that satisfy the predicate p i ai
. The order of the elements
in the input list is preserved.let filter_map : ('a => option 'b) => list 'a => list 'b
filter_map f l
calls (f a0) (f a1).... (f an)
where a0,a1..an
are
the elements of l
. It returns the list of elements bi
such as
f ai = Some bi
(when f
returns None
, the corresponding element of
l
is discarded).let filteri_map : (int => 'a => option 'b) => list 'a => list 'b
filter_map f l
calls (f 0 a0) (f 1 a1).... (f n an)
where a0,a1..an
are
the elements of l
. It returns the list of elements bi
such as
f ai = Some bi
(when f
returns None
, the corresponding element of
l
is discarded).let find_all : ('a => bool) => list 'a => list 'a
find_all
is another name for List.filter
.let partition : ('a => bool) => list 'a => (list 'a, list 'a)
partition p l
returns a pair of lists (l1, l2)
, where
l1
is the list of all the elements of l
that
satisfy the predicate p
, and l2
is the list of all the
elements of l
that do not satisfy p
.
The order of the elements in the input list is preserved.let index_of : 'a => list 'a => option int
index_of e l
returns the index of the first occurrence of e
in l
, or None
if there is no occurrence of e
in l
let index_ofq : 'a => list 'a => option int
index_ofq e l
behaves as index_of e l
except it uses
physical equalitylet rindex_of : 'a => list 'a => option int
rindex_of e l
returns the index of the last occurrence of e
in l
, or None
if there is no occurrence of e
in l
let rindex_ofq : 'a => list 'a => option int
rindex_ofq e l
behaves as rindex_of e l
except it uses
physical equalitylet unique : eq::('a => 'a => bool)? => list 'a => list 'a
unique cmp l
returns the list l
without any duplicate element.
The default comparator ( = ) is used if no comparison function
specified.
Implementation Note: The current implementation removes any elements where the tail of the list contains an equal element, thus it keeps the *last* copy of each equal element.
This function takes O(n^2) time.
Since 2.0
See also sort_unique
to save time in cases when reordering the list is
acceptable
let unique_cmp : cmp::('a => 'a => int)? => list 'a => list 'a
unique
, except comparator parameter returns an int. Default
comparator is Pervasives.compare
. This function takes O(n log n)
time.
Implementation Note: The current implementation removes subsequent
elements that compare as equal to earlier elements in the list,
thus it keeps the *first* copy of each equal element.
Since 1.3.0
let unique_hash : hash::('a => int)? => eq::('a => 'a => bool)? => list 'a => list 'a
unique
, except uses a hash table to cut down the expected
runtime to linear, assuming a good hash function. ?hash
defaults to Hashtbl.hash
and ?eq
defaults to (=)
.
Implementation Note: The current implementation removes subsequent
elements that hash and compare as equal to earlier elements in the
list, thus it keeps the *first* copy of each equal element.
Since 2.0.0
let assoc : 'a => list ('a, 'b) => 'b
assoc a l
returns the value associated with key a
in the list of
pairs l
. That is,
assoc a [ ...; (a,b); ...] = b
if (a,b)
is the leftmost binding of a
in list l
.Not_found
if there is no value associated with a
in the
list l
.let assoc_inv : 'b => list ('a, 'b) => 'a
assoc_inv b l
returns the key associated with value b
in the list of
pairs l
. That is, assoc b [ ...; (a,b); ...] = a
if (a,b)
is the leftmost binding of a
in list l
.Not_found
if there is no key associated with b
in the
list l
.let remove_assoc : 'a => list ('a, 'b) => list ('a, 'b)
remove_assoc a l
returns the list of
pairs l
without the first pair with key a
, if any.
Tail-recursive.let mem_assoc : 'a => list ('a, 'b) => bool
List.assoc
, but simply return true if a binding exists,
and false if no bindings exist for the given key.let assq : 'a => list ('a, 'b) => 'b
List.assoc
, but uses physical equality instead of structural
equality to compare keys.let assq_inv : 'b => list ('a, 'b) => 'a
List.assoc_inv
, but uses physical equality instead of structural
equality to compare keys.let remove_assq : 'a => list ('a, 'b) => list ('a, 'b)
List.remove_assoc
, but uses physical equality instead
of structural equality to compare keys. Tail-recursive.let mem_assq : 'a => list ('a, 'b) => bool
List.mem_assoc
, but uses physical equality instead of
structural equality to compare keys.let modify : 'a => ('b => 'b) => list ('a, 'b) => list ('a, 'b)
modify a f l
returns the same list as l
but with value associated
to key a
replaced with f a
.Not_found
if no value is associated with a
in l
let modify_def : 'b => 'a => ('b => 'b) => list ('a, 'b) => list ('a, 'b)
modify_def dfl a f l
performs as modify a f l
except that it
add an association from a
to f dfl
instead of raising Not_found
.let modify_opt : 'a => (option 'b => option 'b) => list ('a, 'b) => list ('a, 'b)
modify_opt a f l
allows to modify the binding for a
in l
or absence thereof.let modify_at : int => ('a => 'a) => list 'a => list 'a
modify_at n f l
returns the same list as l
but with nth-value a
replaced with f a
.Invalid_argument
if the index is outside of l
boundslet modify_opt_at : int => ('a => option 'a) => list 'a => list 'a
modify_at_opt n f l
returns the same list as l
but with
nth-value a
removed if f a
is None
, and replaced by v
if
it is Some v
.Invalid_argument
if the index is outside of l
boundslet split_at : int => list 'a => (list 'a, list 'a)
split_at n l
returns two lists l1
and l2
, l1
containing the
first n
elements of l
and l2
the others.Invalid_argument
if
n
is outside of l
size bounds.let split_nth : int => list 'a => (list 'a, list 'a)
split_at
.let remove : list 'a => 'a => list 'a
remove l x
returns the list l
without the first element x
found
or returns l
if no element is equal to x
. Elements are compared
using ( = ).let remove_if : ('a => bool) => list 'a => list 'a
remove_if cmp l
is similar to remove
, but with cmp
used
instead of ( = ).let remove_at : int => list 'a => list 'a
remove_at i l
returns the list l
without the element at index i
.Invalid_argument
if i
is outside of l
size bounds.let remove_all : list 'a => 'a => list 'a
remove_all l x
is similar to remove
but removes all elements that
are equal to x
and not only the first one.let take : int => list 'a => list 'a
take n l
returns up to the n
first elements from list l
, if
available.let ntake : int => list 'a => list (list 'a)
ntake n l
cuts l
into lists of size at most n
.
n
must be > 0.Invalid_argument
if n
<= 0.
Each list in the result has size n, except the last
one which may have fewer elements in case l
was too short.
Example: ntake 2 [1; 2; 3; 4; 5] = [[1; 2]; [3; 4]; [5]]
let drop : int => list 'a => list 'a
drop n l
returns l
without the first n
elements, or the empty
list if l
have less than n
elements.let takedrop : int => list 'a => (list 'a, list 'a)
take_drop n l
is equivalent to (take n l, drop n l)
but is done in one pass.let take_while : ('a => bool) => list 'a => list 'a
take_while p xs
returns the (possibly empty) longest prefix of
elements of xs
that satisfy the predicate p
.let drop_while : ('a => bool) => list 'a => list 'a
drop_while p xs
returns the suffix remaining after
take_while p xs
.let span : ('a => bool) => list 'a => (list 'a, list 'a)
span
, applied to a predicate p
and a list xs
, returns a
tuple where first element is longest prefix (possibly empty) of xs
of elements that satisfy p and second element is the remainder of
the list. This is equivalent to (take_while p xs, drop_while p xs)
,
but is done in one pass.let nsplit : ('a => bool) => list 'a => list (list 'a)
nsplit
, applied to a predicate p
and a list xs
, returns a
list of lists. xs
is split when p x
is true and x
is excluded
from the result.
If elements that satisfy p
are consecutive, or at the beginning
or end of the input list, the output list will contain empty lists
marking their position. For example,
split (fun n -> n<0) [-1;2;-2;-3;4;-5]
is [[];[2];[];[4];[]]
.
This is consistent with the behavior of String.nsplit
, where
String.nsplit ";" "1;2;;3;" = ["1";"2";"";"3";""]
.
Note that for any xss : 'a list list
and sep : 'a
, we always have
that flatten (interleave [sep] (nsplit ((=) sep) xss))
is xss
.
Since 2.1
let group_consecutive : ('a => 'a => bool) => list 'a => list (list 'a)
group_consecutive
function takes a list and returns a list of lists such
that the concatenation of the result is equal to the argument. Moreover, each
sublist in the result contains only equal elements. For example,
group_consecutive (=) [3;3;4;3;3] = [[3;3];[4];[3;3]]
.
Note: In the next major version, this function is intended to replace the
current group
, which also sorts its input before grouping, and which will
therefore be renamed into something more pertinent, such as classify
,
regroup
, or group_sort
.
Since 2.1
let interleave : first::'a? => last::'a? => 'a => list 'a => list 'a
interleave ~first ~last sep [a0;a1;a2;...;an]
returns
first; a0; sep; a1; sep; a2; sep; ...; sep; an; last
Abstraction layer.
let enum : list 'a => BatEnum.t 'a
let of_enum : BatEnum.t 'a => list 'a
let backwards : list 'a => BatEnum.t 'a
let of_backwards : BatEnum.t 'a => list 'a
let split : list ('a, 'b) => (list 'a, list 'b)
split [(a0,b0); (a1,b1); ...; (an,bn)]
is ([a0; a1; ...; an], [b0;
b1; ...; bn])
.
Tail-recursive.let combine : list 'a => list 'b => list ('a, 'b)
combine [a0; a1; ...; an] [b0; b1; ...; bn]
is
[(a0,b0); (a1,b1); ...; (an,bn)]
.Different_list_size
if the two lists
have different lengths. Tail-recursive.let sort : ('a => 'a => int) => list 'a => list 'a
Pervasives.compare
is a suitable comparison function.
The resulting list is sorted in increasing order.
List.sort
is guaranteed to run in constant heap space
(in addition to the size of the result list) and logarithmic
stack space.
The current implementation uses Merge Sort. It runs in constant
heap space and logarithmic stack space.
let stable_sort : ('a => 'a => int) => list 'a => list 'a
List.sort
, but the sorting algorithm is guaranteed to
be stable (i.e. elements that compare equal are kept in their
original order) .
The current implementation uses Merge Sort. It runs in constant
heap space and logarithmic stack space.
let fast_sort : ('a => 'a => int) => list 'a => list 'a
List.sort
or List.stable_sort
, whichever is faster
on typical input.let merge : ('a => 'a => int) => list 'a => list 'a => list 'a
l1
and l2
are sorted according to the
comparison function cmp
, merge cmp l1 l2
will return a
sorted list containting all the elements of l1
and l2
.
If several elements compare equal, the elements of l1
will be
before the elements of l2
.
Not tail-recursive (sum of the lengths of the arguments).let sort_uniq : ('a => 'a => int) => list 'a => list 'a
sort_uniq cmp l
returns the list l
sorted and without any
duplicate element. cmp
is a usual comparison function providing
total order.
This function takes O(n log n) time.
Since 2.3.0
let sort_unique : ('a => 'a => int) => list 'a => list 'a
sort_uniq
let group : ('a => 'a => int) => list 'a => list (list 'a)
group cmp l
returns list of groups and each group consists of
elements judged equal by comparison function cmp
. Groups in the resulting
list appear in order given by cmp
. All groups are always nonempty. group
returns []
only if l
is empty.
For example group cmp [f;c;b;e;d;a]
can give [[a;b];[c];[d;e;f]]
if
following conditions are met:
cmp a b = 0
, cmp b c = -1
, cmp c d = -1
, cmp d e = 0
,...
See the note on group_consecutive
.
let cartesian_product : list 'a => list 'b => list ('a, 'b)
List.combine
, this returns every pair
of elements formed out of the two lists.
cartesian_product [a0; a1; ...; an] [b0; b1; ...; bn] =
[(a0,b0);(a0,b1); ...; (a0,bn); (a1,b0); ..; (a1, bn);
...; (an,bn)]
. The lists can be of unequal size.let n_cartesian_product : list (list 'a) => list (list 'a)
[a;b];[c];[d;e;f]
, returns
[a;c;d];[a;c;e];[a;c;f];[b;c;d];[b;c;e];[b;c;f]
, all
ways of choosing one element from each input list.let transpose : list (list 'a) => list (list 'a)
let print : first::string? =>
last::string? =>
sep::string? =>
(BatInnerIO.output 'a => 'b => unit) =>
BatInnerIO.output 'a => list 'b => unit
let eq : BatOrd.eq 'a => BatOrd.eq (list 'a)
let ord : BatOrd.ord 'a => BatOrd.ord (list 'a)
let compare : BatOrd.comp 'a => BatOrd.comp (list 'a)
module Eq:
module Ord:
module Comp:
let nth : list 'a => int => 'a
at
.let takewhile : ('a => bool) => list 'a => list 'a
BatList.take_while
let dropwhile : ('a => bool) => list 'a => list 'a
BatList.drop_while
List
with functions
behaving slightly differently but having the same name. This is by
design:
the functions meant to override the corresponding functions of List
.module Exceptionless:{
..}
module Infix:{
..}
module Labels:{
..}
List
with labels.
let (@) : list 'a => list 'a => list 'a
List.append
.


Britain's vote to leave European Union will have long lasting implications on World's economy. Business leaders and Economists around the world have already started speculating short term as well as long term impact of this historical decision. The vote to exit EU came as a surprise and will impact businesses and students who will be going out in the job market full of uncertainities.
The Pandora's box is now open and we have already started experiencing knee-jerk reaction to the Euro as well Stock markets around the globe. Trillion of dollars have already been lost in just 48 hours and it is just the beginning. As businesses will start to settle down in this new era of political and macroeconomic uncertainity, the consequences of this decision will be hard to predict.
Well the bigger question is whether it is justifiable that a such a small difference of votes ( 4% of Britons ~1,26,950) is enough to change the course of history when most of the Britons are frantically Googling what EU is after they have voted ? Only time will tell, how this decision will impact our lives but it certainly has shown the ugly side of Democracy. Leaving important decisions in hands of people who don't even understand the implications of it.
As I am going to embark upon my MBA journey in uncertain times, one thing is for certain that Brexit will be an interesting case study :)
I wanted to challenge myself post I.D.E.A so I decided to pursue my MBA to gain the necessary business skills. With this new goal in mind, my MBA journey got kickstarted. I am quite excited that I will officially start my journey soon in Fall'16 at Olin Business School at Washington University, St. Louis
I hope to utilize the next two years to sharpen my business knowledge and continue to experiment with my ideas and hopefully bring to life some of them ! I am quite excited to start this new phase of my life.


See: Description
| Class | Description |
|---|---|
| CorePlanboardBusinessService |
Global BusinessService class to help with methods used in multiple roles.
|
| IncomingMessageVerificationService |
Service class in charge of business validations on incoming messages (before they are sent to the incoming queue).
|
| MessageEncryptionService |
Business Service class in charge of the encryption/decryption/signing of the different messages.
|
| MessageFilterService |
Service class in charge of filtering incoming HTTP messages and, based on the denylisted addresses (IP or EA), accept or reject
them.
|
| MessageService |
Business Service class in charge of operations concerning the
Message entities. |
| ParticipantDiscoveryService |
Service class in charge of the discovery of the participants on the network when a message arrives.
|
| ParticipantListBuilder |
This service class builds a participant lists from a YAML file.
|
| PlanboardHousekeepingBusinessService |
Business service class in charge of housekeeping operations concerning the common planboard.
|
| PrognosisConsolidationBusinessService |
Service class in charge of operations related to the Prognosis Consolidation.
|
| SequenceGeneratorService |
This service is in charge of the generation of unique sequence numbers that can be used in messages.
|
| SignedMessageHashService |
Business Service class in charge of the operations related to the
SignedMessageHash entity. |
| TransportHousekeepingBusinessService |
Business service class in charge of housekeeping operations concerning transport layer.
|
Copyright © 2016. All rights reserved.


| Name: mr. NANDA KUMAR | Reg No: 6-8SMHC17 |
|---|---|
| Age / Sex:60/M | Contact No:9945115673 |
| Marital Status:M | Date:17/8/17 |
| Occupation:RETD.ASSTM] MANAGER BOSCH | Dr. PJFP |
| Address:NATIVE OF BLORE. | DIAGNOSIS- |
GASTRITIS SINCE 20 YEARS.

DOESN’T FEEL HUNGER AT ALL. EVEN SINCE CHILDHOOD. JUST EATS ACC TO TIME.
LEFT SIDE ABD PAIN IF EATS HEAVY FOOD.
CHOLESTEROL HIGH SINCE 20 YRS: SOM DOC TOLD BECAUSE HIS CONSTIPATION AND NO APP.
DM SINCE 15 YEARS
BP SINCE 25 YEARS: REG CHECKS BP WAS HIGH SO STARTED TO TAKE BP.
BACK CATCHS WHEN DOING SOME< CLEANIN, LAUGHING, MORNINGS
>LYING ON BACK.
4. BUTTOCKS PAIN <HARD SURFACE AND LONG SITTING.
HAS SPONDYILITIS WHEN WENT TO PHYSIOTHERAPIST.
\ SINCE 2-3 MONTHS. >MASSAGE, HOT APPLICATION
MILK AVERSION.
CRAVES TEA +++
DOESN’T SAY ANYTHING. ONLY WHEN WIFE IS ASKING OR UNBEARABLE THEN WILL SAY..

SNEEZING MUST TAKE MED FR IT TO STOP. FEELS SOMETHIN IS STUCK IN THROAT EVEN IF SWALLOWS WILL NOT REDUCE
ROXIDEN AND GRENIL ALLO RX.
CONSTIPATION SINCE CHILDHOOD.
MUST STRAIN TO PASS. NO URGE FR 1 -2 DAYS. NO PAIN.
IF LEANS TO SIDES FEEL WILL FALL ON THE SAME SIDE.
LEFT LEG IN BETWN LST TOE AND 4TH TOE FUNGAL INFECTION.
ITCHING < PRESSING
FEELS LIKE EARLIER HE USE TO WORK IN FACTORY BUT 25 YEARS BACK PROMOTED AS ASST.MANAGER WHER THE PRESSURE OF WORK WAS MORE.
PAST H/O:
DNS SURGERY 20-25 YEARS BACK.
FURUNCLE ON BACK OFFENSIVE.
FAMILY H/O:
MOM: BP,DM IN OLD AGE. ARTHRITIS. HAD WHITE LEG AS SOON AS PT WAS BORN.
DAD: BP HEART PBM
PERSONAL:
1LT /DAY.
IF DRINKS MORE MUS GO TO URINE SO DRINKS LESS.
CIGARRETTES 40 YEARS .
OCASSIONAL DRINKING
ANGRY, SHOUTS
CHILY PAT.
SWEAT LESS.
SLEEP: 6 HRS
DREAMS:
LESS TALKATIVE FEELS MAY B WRNG TO OTHERS OR BAD TO OPP PERSON.
NEGETIVE THINKING – MUST GO SOMEWHRE MAY NOT LISTEN WHT I SAY MAY NOT BE THER. POSITIVE THINKING IS LESS.
MUSIC LIKES.
LIKES TO COVER IN SLEEP.
RX:
LYCO 200 – 3 DOSES – 5 DAYS ONCE.
CALC PHOS 12 X – 4-4-4-4
THUJA 200 – 2 DOSES – WWEKLY. B/BRUSH WATER.


Widgets for CMV, the configurable map viewer.
Created by Tim McGee of MoosePoint Technology.
Each widget in this repo has at least one configuration example in the config folder. This folder also contains additional examples for including ESRI widgets, other widgets and functionality.
A highly configurable widget to display the results of one or more Query, Find or Geoprocessor Tasks.
Coming Soon
A simple widget containing a button to toggle the CMV map to a maximized full screen view and restore it to the original dimensions.
An example widget demonstrating the display of results from a Geoprocessing Task in the Attributes Tables widget.
Coming Soon
Used in conjunction with the Attribute Table widget to provide a user interface for querying feature layers, dynamic layers, tables and related records using QueryTask and FindTask.
Share your map by using Facebook, Twitter, Google+, E-Mail, Link, or embedded iFrame code.
A simple widget to provide a drop-down list of features to zoom to on the map. Similar to bookmarks but driven by actual data in a Map Service.


---
layout: archive
title: Lean Prover Zulip Chat Archive
permalink: 113488general/74264minofnonemptysetofnats.html
---
The archive URL format has changed. Please find this page at:
https://leanprover-community.github.io/archive/stream/113488-general/topic/min.20of.20non-empty.20set.20of.20nats.html


from __future__ import absolute_import
from collections import OrderedDict
from itertools import combinations
from functools import reduce
from operator import mul
import resource
from devito.ir.iet import Iteration, FindNodes, FindSymbols
from devito.logger import perf, warning
from devito.parameters import configuration
__all__ = ['autotune']
[docs]def autotune(operator, arguments, parameters, tunable):
"""
Acting as a high-order function, take as input an operator and a list of
operator arguments to perform empirical autotuning. Some of the operator
arguments are marked as tunable.
"""
# We get passed all the arguments, but the cfunction only requires a subset
at_arguments = OrderedDict([(p.name, arguments[p.name]) for p in parameters])
# User-provided output data must not be altered
output = [i.name for i in operator.output]
for k, v in arguments.items():
if k in output:
at_arguments[k] = v.copy()
iterations = FindNodes(Iteration).visit(operator.body)
dim_mapper = {i.dim.name: i.dim for i in iterations}
# Shrink the iteration space of time-stepping dimension so that auto-tuner
# runs will finish quickly
steppers = [i for i in iterations if i.dim.is_Time]
if len(steppers) == 0:
timesteps = 1
elif len(steppers) == 1:
stepper = steppers[0]
start = at_arguments[stepper.dim.min_name]
timesteps = stepper.extent(start=start, finish=options['at_squeezer']) - 1
if timesteps < 0:
timesteps = options['at_squeezer'] - timesteps
perf("AutoTuner: Number of timesteps adjusted to %d" % timesteps)
at_arguments[stepper.dim.min_name] = start
at_arguments[stepper.dim.max_name] = timesteps
if stepper.dim.is_Stepping:
at_arguments[stepper.dim.parent.min_name] = start
at_arguments[stepper.dim.parent.max_name] = timesteps
else:
warning("AutoTuner: Couldn't understand loop structure; giving up")
return arguments
# Attempted block sizes ...
mapper = OrderedDict([(i.argument.symbolic_size.name, i) for i in tunable])
# ... Defaults (basic mode)
blocksizes = [OrderedDict([(i, v) for i in mapper]) for v in options['at_blocksize']]
# ... Always try the entire iteration space (degenerate block)
itershape = [mapper[i].iteration.symbolic_extent.subs(arguments) for i in mapper]
blocksizes.append(OrderedDict([(i, mapper[i].iteration.extent(0, j-1))
for i, j in zip(mapper, itershape)]))
# ... More attempts if auto-tuning in aggressive mode
if configuration['autotuning'].level == 'aggressive':
blocksizes = more_heuristic_attempts(blocksizes)
# How many temporaries are allocated on the stack?
# Will drop block sizes that might lead to a stack overflow
functions = FindSymbols('symbolics').visit(operator.body +
operator.elemental_functions)
stack_shapes = [i.symbolic_shape for i in functions if i.is_Array and i._mem_stack]
stack_space = sum(reduce(mul, i, 1) for i in stack_shapes)*operator._dtype().itemsize
# Note: there is only a single loop over 'blocksize' because only
# square blocks are tested
timings = OrderedDict()
for bs in blocksizes:
illegal = False
for k, v in at_arguments.items():
if k in bs:
val = bs[k]
start = mapper[k].original_dim.symbolic_start.subs(arguments)
end = mapper[k].original_dim.symbolic_end.subs(arguments)
if val <= mapper[k].iteration.extent(start, end):
at_arguments[k] = val
else:
# Block size cannot be larger than actual dimension
illegal = True
break
if illegal:
continue
# Make sure we remain within stack bounds, otherwise skip block size
dim_sizes = {}
for k, v in at_arguments.items():
if k in bs:
dim_sizes[mapper[k].argument.symbolic_size] = bs[k]
elif k in dim_mapper:
dim_sizes[dim_mapper[k].symbolic_size] = v
try:
bs_stack_space = stack_space.xreplace(dim_sizes)
except AttributeError:
bs_stack_space = stack_space
try:
if int(bs_stack_space) > options['at_stack_limit']:
continue
except TypeError:
# We should never get here
warning("AutoTuner: Couldn't determine stack size; skipping block shape %s"
% str(bs))
continue
# Use AutoTuner-specific profiler structs
timer = operator.profiler.timer.reset()
at_arguments[operator.profiler.name] = timer
operator.cfunction(*list(at_arguments.values()))
elapsed = sum(getattr(timer._obj, i) for i, _ in timer._obj._fields_)
timings[tuple(bs.items())] = elapsed
perf("AutoTuner: Block shape <%s> took %f (s) in %d timesteps" %
(','.join('%d' % i for i in bs.values()), elapsed, timesteps))
try:
best = dict(min(timings, key=timings.get))
perf("AutoTuner: Selected block shape %s" % best)
except ValueError:
warning("AutoTuner: Couldn't find legal block shapes")
return arguments
# Build the new argument list
tuned = OrderedDict()
for k, v in arguments.items():
tuned[k] = best[k] if k in mapper else v
# Reset the profiling struct
assert operator.profiler.name in tuned
tuned[operator.profiler.name] = operator.profiler.timer.reset()
return tuned
def more_heuristic_attempts(blocksizes):
# Ramp up to higher block sizes
handle = OrderedDict([(i, options['at_blocksize'][-1]) for i in blocksizes[0]])
for i in range(3):
new_bs = OrderedDict([(k, v*2) for k, v in handle.items()])
blocksizes.insert(blocksizes.index(handle) + 1, new_bs)
handle = new_bs
handle = []
# Extended shuffling for the smaller block sizes
for bs in blocksizes[:4]:
for i in blocksizes:
handle.append(OrderedDict(list(bs.items())[:-1] + [list(i.items())[-1]]))
# Some more shuffling for all block sizes
for bs in list(blocksizes):
ncombs = len(bs)
for i in range(ncombs):
for j in combinations(bs, i+1):
item = [(k, bs[k]*2 if k in j else v) for k, v in bs.items()]
handle.append(OrderedDict(item))
unique = []
for i in blocksizes + handle:
if i not in unique:
unique.append(i)
return unique
options = {
'at_squeezer': 4,
'at_blocksize': sorted({8, 16, 24, 32, 40, 64, 128}),
'at_stack_limit': resource.getrlimit(resource.RLIMIT_STACK)[0] / 4
}
"""Autotuning options."""


Fiona Hill: Ukraine election meddling "fictional narrative" told by Russia
The truth is that Russia was the foreign power that systematically attacked U.S. democratic institutions in 2016, the expert stressed.
Former White House Russia expert Fiona Hill has told the House Intelligence Committee during an open hearing as part of the Donald Trump impeachment inquiry that the idea that Ukraine meddled in the 2016 U.S. presidential election is a "fictional narrative that has been perpetrated and propagated by the Russian security services."
"Based on questions and statements I have heard, some of you on this committee appear to believe that Russia and its security services did not conduct a campaign against our country — and that perhaps, somehow, for some reason, Ukraine did," she said, according to CNN.
"This is a fictional narrative that has been perpetrated and propagated by the Russian security services themselves," Hill stressed.
"The unfortunate truth is that Russia was the foreign power that systematically attacked our democratic institutions in 2016. This is the public conclusion of our intelligence agencies, confirmed in bipartisan congressional reports. It is beyond dispute, even if some of the underlined details must remain classified."


http://action.vday.org/site/R?i=GY_52LsE32teQO1wlWBXRA
http://action.vday.org/site/R?i=UT9-QOg7Cz7bmaBXwnGiZw
http://action.vday.org/site/R?i=I1nxg7oG4dVNhs35jRXLSw
http://action.vday.org/site/R?i=C73t_drk8hipN93WKMiMKA
RISING Blog Series: Farmworkers, European Women’s Lobby & V-Day
Staff
In this fourth installment of the RISING Blog series
onebillionrising.org/pages/rising-blog
, we hear from Mily Trevino-Saucedo executive director of Lideres
Campesinas, Colette de Troy & Valentina Brogna from the European
Women’s Lobby; and V-Day staff members Tony Montenieri and Kate
Fisher.
http://action.vday.org/site/R?i=YHGpkiv0O6Tp45ONTvc5qQ
BRUSSELS RISING
by Colette de Troy & Valentina Brogna, Regional Coordinators
(European Women’s Lobby)
One Billion Rising was an exciting way of campaigning against violence
against women. We used music and art, we danced and sang, using our
bodies to protest and to occupy public spaces so that our message
could not be ignored and could be conveyed in a positive, non-violent
way.
CONTINUE reading >
http://action.vday.org/site/R?i=9a8r3RKs1wkZMMXFoH6pnw
http://action.vday.org/site/R?i=lFHrb3–Ypn-pY-Nv7G0IQ
FARMWORKERS RISING
by Mily Trevino-Saucedo, Regional Coordinator
¡Gracias a Eve y a toda la gente de V-Day que nos animó a
ser parte de este esfuerzo global! Nos sentimos parte de un mundo que
aún cree en la justicia, la paz y la no violencia.
CONTINUE reading >
http://action.vday.org/site/R?i=iv_934zvXeinik5rODA4-w
http://action.vday.org/site/R?i=c7HthiVi4GdLPivAhYD4pA
MY PERSONAL JOURNEY TO ONE BILLION RISING
by Tony Montenieri, V-Day Director of Operations
OBR technically began for me on February 14th 2012. Eve was flying
from Australia to Los Angeles where after being on a plane for 14
hours she would get off the plane and head to CNN to announce the
global action called One Billion Rising.
CONTINUE reading >
http://action.vday.org/site/R?i=bolOkeD-xqxLmbXb0xVqhg
http://action.vday.org/site/R?i=ZCBbqYhlNtqz2FWT_6PuDw
I’M NOT A DANCER
by Kate Fisher, V-Day Communications & Special Events Director
I’m not a dancer. I’m not overly coordinated. I’m a little
self-conscious, I’m not at all graceful, and my rhythm is suspect.
CONTINUE reading >
http://action.vday.org/site/R?i=G3BSwWFdebftz5FySbtRlA
RISE with Your Fellow Activists for V-Season 2013!
Bangladesh, Iran, the Yale Divinity School, New Dehli, Qatar, Ecuador,
Russia, Jerusalem, Vienna, Namibia, Turkey, Germany, Nigeria, Japan,
Bolivia…these are just a fraction of the over 1,500 locations (and
still growing) where V-Day benefit events are taking place this
V-Season. V-Activists everywhere are taking the energy from ONE
BILLION RISING and using it in their communities to raise funds and
awareness to end violence against women and girls.
http://action.vday.org/site/R?i=ScToPLlDH_gBc-hEm2BVkw
With four weeks left, there are hundreds of V-Day benefit events
taking place throughout the world, so check out our V-Map
http://action.vday.org/site/R?i=a2mie-LEc-1pvzXr2zua6w
, find an event near you, and don’t miss this opportunity to keep the
momentum going!
ATTEND an event near you >
http://action.vday.org/site/R?i=-b0wBtzpL8nCqkwywv0Tqw
http://action.vday.org/site/R?i=ix6nE-flG7_DHg-CGTxcSA
http://action.vday.org/site/R?i=zWuxXsRRfXAmmIcF4cENsg
http://action.vday.org/site/R?i=GHIL6x5pvHOtq7cTCP2JAg
http://action.vday.org/site/R?i=e5HnENVHbT0n_owVnPshSg
http://action.vday.org/site/R?i=6fCCwbbWasiKNHoz7KMJLA
unsubscribe
http://action.vday.org/site/CO?i=Wq6NqJRbt9xBfowxhBzntefyQb1t64lZ&cid=1062
Powered By Convio


flibs/datastructures(n) 1.0 "flibs"
flibs/datastructures - Linked lists
TABLE OF CONTENTS
SYNOPSIS
DESCRIPTION
ROUTINES
COPYRIGHT
The linkedlist.f90 source file allows you to implement
linked lists of any (derived) type without having to edit
the supplied source code. To this end a simple technique is used,
which is best illustrated by an example:
| |
module MYDATA_MODULE
type MYDATA
character(len=20) :: string
end type MYDATA
end module
module MYDATA_LISTS
use MYDATA_MODULE, LIST_DATA => MYDATA
include "linkedlist.f90"
end module MYDATA_LISTS
|
The above code defines a module MYDATA_MODULE with the derived
type that is to be stored in the linked lists. The name of that derived
type can be anything.
It also defines a module MYDATA_LISTS which will be the module
that holds the functionality to use linked lists:
-
The module MYDATA_MODULE is used, but the derived type
MYDATA is renamed to the (fixed) name LIST_DATA. (This
is the name used in the generic source file.)
-
The source code for the actual routines is simply included via the
INCLUDE statement.
-
Nothing more is required, we can close the source text for the module.
To use a single type of linked lists in a program, we can just use the
MYDATA_LISTS module. If you need more than one type of data in linked
lists, then apply the same renaming trick on using the specific linked
lists modules.
In fact the example in the source file "two_lists.f90" shows the general
technique of how to accomplish this.
The source file linkedlist.f90 provides the following
routines:
- call list_create( list, data)
-
Create a new list with one element. The given data are copied and stored
in that element.
- type(LINKED_LIST), pointer list
-
The variable that will be used for accessing the list
- type(LIST_DATA), intent(in) data
-
The data to be stored in the first element
- call list_destroy( list)
-
Destroy the list. All elements contained in it will be destroyed as
well.
- type(LINKED_LIST), pointer list
-
The list to be destroyed
- count = list_count( list)
-
Function to return the number of elements in the list.
- type(LINKED_LIST), pointer list
-
The list in question
- next => list_next( elem )
-
Function to return the next element in the list. Note: it returns a
pointer to the next element, so you must use =>.
- type(LINKED_LIST), pointer elem
-
The element in the list
- call list_insert( elem, data )
-
Insert a new element (with the given data) into the list, after
the given element.
- type(LINKED_LIST), pointer elem
-
The element in the list after which to insert a new one.
- type(LIST_DATA), intent(in) data
-
The data to be stored in the new element
- call list_insert_head( list, data )
-
Insert a new element (with the given data) before the head of list.
The argument "list" will point to the new head.
- type(LINKED_LIST), pointer list
-
The list in question
- type(LIST_DATA), intent(in) data
-
The data to be stored at the new head
- call list_delete_element( list, elem )
-
Delete the given element from the list. The associated data
will disappear.
- type(LINKED_LIST), pointer list
-
The list in question
- type(LINKED_LIST), pointer elem
-
The element to be deleted
- call list_get_data( elem, data )
-
Copy the data belonging to the given element into the argument "data".
- type(LINKED_LIST), pointer list
-
The element in question
- type(LIST_DATA), intent(out) data
-
The variable to hold the data
- call list_put_data( elem, data )
-
Copy the given data into the given element (overwriting the previous)
- type(LINKED_LIST), pointer list
-
The element in question
- type(LIST_DATA), intent(in) data
-
The new data
Notes:
-
The lists can only store data of the same derived type. In that sense
the code is not generic.
-
Currently, the lists can only store derived types that do not require
an explicit destruction. If you want to store a derived type with
pointers to allocated memory, you can do that however, by supplying an
assignment operator. This would lead to a memory leak though. It is best
to wait for the next version which will allow such derived types to be
stored.
Copyright © 2005 Arjen Markus <arjenmarkus@sourceforge.net>


This is a title
This is the content of the box, it wraps round fine
This is a title
This is the content of the box, it wraps round fine
This is a title
This is the content of the box, it wraps round fine
Example of a Bar Chart
Example of a Radar Chart
This is a title
This is the content of the box, it wraps round fine


Landing Page
Special Projects
This story is part of a series of specially designed stories that represents some of the best journalism The Post has to offer. Check out the rest of the special projects here.
8/23/2018
Compared to other universities in the state, Ohio University’s dining halls reduce the greatest amount of food waste through composting.
Uneaten food is thrown away, then dumped into a landfill. In 2016, landfills accounted for 16 percent of the United States’ methane emissions, according to the U.S. Environmental Protection Agency.
Taylor Johnston | ILLUSTRATION
OU began composting in 2009, and the facility was expanded in 2012. The university’s compost facility is one of the largest in-vessel facilities in the nation, Steve Mack, director of Facilities Management, said. In-vessel composting is a system that confines compost materials into a building or container.
Of Mid-American Conference schools in Ohio, OU, Bowling Green State University and the University of Akron track their composting. Of the three, OU produces the most. It is unclear whether the University of Toledo tracks composting — the university did not provide public records requested by The Post before press time and did not respond to multiple follow-up emails.
OU averages about 504 tons of compost each year, while BGSU and Akron average fewer than 70 tons per year.
BGSU, Miami University and Akron use outside compost haulers to transport their compost to outside facilities. Kent State University does not compost.
“There has been no composting,” Stephanie Jones, a special assistant in the Kent State University General Counsel’s Office, said in an email in response to a request for composting data.
When universities use outside sources to compost, it has its costs.
It costs BGSU $30 to transport each ton to its compost facility and $79 per ton for Akron. Miami paid an average of about $1,300 per month at its previous facility and approximately $150 to $1,100 at its most recent facility.
OU handles its own composting and does not use any outside facilities or sources. It costs the university about $240 per ton of compost.
The facility can also manage all forms of organic waste, speed the processing of waste into soil, control odors and also minimize staff time for operations, Mack said.
At each of the dining halls, staff place both pre-consumer and post-consumer waste in collection bins.
“Culinary provides compost bins for non-edible produce waste at their Central Food Facility, compost bins in each of the dining court kitchen areas for food waste and compost bins in each dining court dish room to collect post-consumer food waste,” Rich Neumann, director of Culinary Services, said in an email.
OU became a ‘trayless’ campus by the beginning of the 2017 Fall Semester. Since then, the university has seen a decrease in waste.
“Based on studies conducted by the OHIO Zero Waste Team at the Voinovich School, post-consumer plate waste has dropped by more than half – from 4.65 ounces of waste per [plate] with trays to 2.30 ounces of waste per plate without trays,” Neumann said in an email.
Culinary Services has also taken more initiative to educate students about the negative effects of waste on campus, he said.
“Signs are posted in all Dining Courts encouraging students to take only what they know they will eat and to not be shy about asking for smaller portions,” Neumann said in an email.
All of the dining halls on campus have multiple self-serve stations that allow students to take only what they will eat.
“Such self-service stations have had a positive effect on reducing food waste,” Neumann said in an email. “Smaller plates and bowls have also been introduced to reduce post-consumer food waste through more controlled portion sizes.”
After the facility goes through its composting process, the composted materials are then used in soil throughout the campus, Mack said.
While the university only composts items from the dining halls, it may collect from residence halls or other campus markets later on.
“Currently, we do not have the infrastructure to begin collection at the residence halls; however, it is something that we will evaluate in the future,” Mack said in an email.
A previous version of this article incorrectly named the Mid-American Conference. The article has been updated to reflect the most accurate information.
Landing Page
This story is part of a series of specially designed stories that represents some of the best journalism The Post has to offer. Check out the rest of the special projects here.


Rabbit out of a hat! Van Gisbergen snatches Race 31 pole position in Newcastle
by James PaveyShane van Gisbergen pulled a rabbit out of the hat to clinch pole position for Race 31 at the Coates Hire Newcastle 500.
Van Gisbergen was the first driver out in the fight for pole, and as rivals came and went, the 2016 champion’s 1:10.2817s lap proved too far out of reach.
Series champion Scott McLaughlin was third man out, and missed van Gisbergen’s time by just 0.0627s to be the meat in a Red Bull Holden Racing Team sandwich.
Stream the 2019 Coates Hire Newcastle 500. Live & Ad-Break Free During Racing on KAYO SPORTS. Get your 14 day free trial >
READ MORE
J-Dub P1: Whincup tops hectic Newcastle qualifying as ill Pye finds the wall
‘I love banter, but that’s s**t’: Instagram spat triggers Supercars intervention
‘Very difficult’: Drivers grapple with tweaked circuit, tough conditions
Doesn’t get closer than that! Whincup leads Newcastle practice by just 0.0057s
Provisional pole winner Jamie Whincup missed top spot by just 0.1070s and was a tenth down on his qualifying time set earlier in the day.
Cameron Waters (#6 Monster Energy Mustang) slotted into fourth ahead of Anton De Pasquale (#99 Penrite Racing ZB Commodore), with both drivers within two tenths of van Gisbergen’s benchmark.
Fabian Coulthard outqualified McLaughlin earlier in the day, but managed sixth and was over two tenths down on his Shell V-Power Racing Team stablemate.
Second-man-out David Reynolds (#9 Penrite Racing ZB Commodore) was seventh ahead of James Courtney (#22 Walkinshaw Andretti United ZB Commodore), Tim Slade (#14 Freightliner Racing ZB Commodore) and Lee Holdsworth (#5 The Bottle-O Racing Team Mustang).
LISTEN TO THE LATEST PODCAST: Mark Skaife l Post-Bathurst Controversy Mkii l Bairdo’s bungle l Triple Eight Turnaround
SUBSCRIBE TO THE SHOW: iTUNES | SPOTIFY | STITCHER
It was a sublime performance by van Gisbergen, who nearly missed the Shootout altogether after sneaking into the top 10 in a thrilling qualifying session.
The result marks the first time since 2009 (Garth Tander, Tasmania) that the first driver out in the Shootout walked away with pole.
“The car has been awesome all weekend, just no good on new tyres,” said van Gisbergen, praising his team for turning the car around on set-up.
“I was just stoked with that, they did a great job tuning it, getting the tyre phasing better.
“I just can’t believe we went from 10th there to the front. It’s critical here.
“Beside my mate Scotty, so it’ll be good.”
The 95-lap Race 31 will commence at 4:15pm AEDT.
Full results here.


Shifts the pitch, frequency, or partial position of a set of partials.
- Input
- The input partials to shift.
- Shift
- Shifts the pitch, frequency, or partial position. Shift can be positive or negative.
- Bound
- The maximum range of the shift modulation.
- Type
-
- Pitch
- Shift by pitch. This changes the frequency of the partials exponentially. You can shift by up to several octaves. This can be used in combination with the Seq module to change note pitches: see the Help panel of the Seq module.
- Frequency
- Shift by pitch. This simply adds a constant value to the frequency of all the partials.
- Partials
- Shift by partials. This moves each partial frequency up (or down) to the frequency value occupied by the neighboring partial
- Vibrato
- Shift by pitch, but by a much smaller amount (at most a half step in each direction). This can be used with an LFO to provide a small amount of vibrato.


1 write to AcceptedSuggestions
powershell-tests (1)
csharp\test_Prediction.cs (1)
54
AcceptedSuggestions
= new List<string>();
6 references to AcceptedSuggestions
powershell-tests (6)
csharp\test_Prediction.cs (6)
62
AcceptedSuggestions
.Clear();
103
AcceptedSuggestions
.Add($"{client.Name}-{session}-{acceptedSuggestion}");
215
slow.
AcceptedSuggestions
.Count == 0)
240
Assert.Single(slow.
AcceptedSuggestions
);
241
Assert.Equal($"{Client}-{Session}-Yeah", slow.
AcceptedSuggestions
[0]);
243
Assert.Empty(fast.
AcceptedSuggestions
);


Train Time!
Schdule Your Ride!
Current Train Schdule
Train Name
Destination
Frequency
Next Arrival
Minutes Away
ADD TRAIN
Train Name
Destination
First Train Time (HH:mm - Military Time)
Frequency (Min)
Submit!


Independence: Americans strongly believe in the concept of individualism. They consider themselves to be separate individuals who are in control of their own lives, rather than members of a close-knit, interdependent family, religious group, tribe, nation, or other group.
Equality: The American Declaration of Independence states that “all [people] are created equal,” and this belief is deeply embedded in their cultural values. Americans believe that all people are of equal standing, and are therefore uncomfortable with overt displays of respect such as being bowed to.
Danes may seem a little private at first – not wanting to intrude on other people’s personal space uninvited. The best advice is to make the first move - go ahead and say hello. You’ll soon discover that most Danes are very approachable, friendly and helpful.
Generally, Danes avoid superficiality and hype.  A polite and honest approach is always best.
This of course does not mean that Danes lack humour. While Danes might seem reserved at first, you will usually find them to be outspoken and fun-loving once you get to know them. Indeed, humour – especially irony – is an integral part of Danish culture.
The Brazilian people are very friendly and social. They will engage you in animated conversations and especially enjoy talking about soccer, family, and children. They prefer face-to-face contact and do not like to do business over the phone or through email.
Despite poverty and difficult circumstances, the Brazilian people are undeterrably optimistic. Predominately Roman Catholic, they have a strong belief in God, and it is this faith that sustains them through life's difficulties. The people of Brazil are comfortable with spirituality and talk openly about spiritual things, unlike many other cultures that feel one's religious allegiances should be private and personal, not discussed publicly.
Kenyans are group-orientated rather than individualistic. “Harambee,” (coming from the Bantu word meaning “to pull together”) defines the people’s approach to others in life. The concept is essentially about mutual assistance, mutual effort, mutual responsibility and community self-reliance. This principle has historically been practiced by every ethnic group with its roots in cooperative farming or herding. Harambee took on a more political resonance when used at the time of independence by Jomo Kenyatta as a way to bring people together.
As you might expect in a group-orientated culture, the extended family is the basis of the social structure. It includes relatives on both sides of the family as well as close friends. Quite often the husband’s parents will live with the nuclear family when they get older and can no longer care for themselves. When people marry, they join their families, thus ensuring that there will always be a group to turn to in times of need.
The Chinese are very conscious of face. Face is essentially respect in a community and is a crucial underpinning of society. Loss of that respect threatens the relations of individuals with almost everyone in his or her world and is hard to get back once lost, and thus must be avoided at all costs
Chinese often appear shy and self conscious to Westerners, especially when they are around foreigners or are in situations which they are not used to. Chinese don't like to be separated from crowd, stared at or asked too many personal questions (even though they often stare at and ask personal questions of Westerners).
Aussie Modesty: Australians are very down to earth and always mindful of not giving the impression that they think they are better than anyone else.They value authenticity, sincerity, and loathe pretentiousness.Australians prefer people who are modest, humble, self- deprecating and with a sense of humour. They do not draw attention to their academic or other achievements and tend to distrust people who do. They often downplay their own success, which may make them appear not to be achievement-oriented.
Meeting Etiquette: Australians are not very formal so greetings are casual and relaxed. A handshake and smile suffices. While an Australian may say, 'G'day' or 'G'day, mate', this may sound patronizing from a foreigner. Visitors should simply say, 'Hello' or 'Hello, how are you?' Aussies prefer to use first names, even at the initial meeting


Strong
Normal – text Em.
Normal
Break Line
var i = 0;
alert(i);
It always seems impossible until it is done.
Nelson Mandela
Strong in Code
Some inline in text.
Some EMIt always seems impossible until it is done.
Nelson MandelaIt always seems impossible until it is done.
Nelson Mandela


|
Figure 1
|
Geographical distribution of the 360 weather stations used i ... |
|
Figure 2
|
Linear trends and anomalies from annual means of S T max , S ... |
|
Figure 3
|
Spatial patterns of changes in soil surface temperatures ( S ... |
|
Figure 4
|
Spatial and seasonal patterns of changes in soil surface tem ... |
|
Figure 5
|
Partial correlation coefficients between S T max , S T min , ... |
|
Figure 6
|
Spatial patterns of changes in sunshine duration (SD) during ... |
|
Figure 7
|
( a) Precipitation (p) on annual and seasonal scales in Chin ... |
|
Figure 8
|
Linear trends from annual means of daily T D on annual and s ... |
|
Figure 9
|
Time series and linear trends from annual means of S T m e a ... |


{% extends "base.html" %} {% block head %} {% assets "css_notes" %} {% endassets %} {% endblock %} {%block body_content %} {% include "notesapp/common/_account-nav.html" %}
Sorry this page doesn't work exist yet.
Comeback soon though, we are working on it.


Conversor C to Portugol (One-sided still)
C
#include
#include
int main () { printf("Hello Reader! You're the world I am talking about."); return 0; }
Portugol
ALGORITMO ESCREVA "Hello Reader! You're the world I am talking about." FIM_ALGORITMO