class: center, top, title-slide # STAT 302, Lecture Slides 8 ## Statistical Prediction ### Bryan Martin --- # Outline 1. Training and Testing 2. Cross-validation 3. Statistical Prediction Algorithms .middler[**Goal:** Learn the concepts, terminology, and techniques in statistical prediction!] --- # Acknowledgement This lecture borrows heavily from the Ryan Tibshirani's [Statistical Prediction lecture](http://www.stat.cmu.edu/~ryantibs/statcomp/lectures/prediction.html) for Statistical Computing at Carnegie Mellon University. --- class: inverse .sectionhead[Part 1. Training and Testing] --- # Recall: Regression Let's assume we have some data `\(X_1,\ldots,X_p, Y\)` where `\(X_1,\ldots,X_p\)` are `\(p\)` **independent variables/explanatory variables/covariates/predictors** and `\(Y\)` is the **dependent variables/response/outcome**. We want to know the relationship between our covariates and our response, we can do this with a method called **regression**. Regression provides us with a statistical method to conduct * **inference:** assess the relationship between our variables, our statistical model as a whole, predictor importance * What is the relationship between sleep and GPA? * Is parents' education or parents' income more important for explaining income? * **prediction:** predict new/future outcomes from new/future covariates * Can we predict test scores based on hours spent studying? --- # Recall: Linear Regression Given our response `\(Y\)` and our predictors `\(X_1, \ldots, X_p\)`, a **linear regression model** takes the form: \\[ \LARGE `\begin{eqnarray} &Y &= \beta_0 + \beta_1 X_1 + \cdots + \beta_p X_p + \epsilon,\\ &\epsilon &\sim N(0,\sigma^2) \end{eqnarray}` \\] Previously, we focused on using this model for inference (e.g. `\(H_0: \beta_1 = 0\)`). Today, we are shifting our focus to prediction! --- # Statistical Prediction Often, we use a linear model even when we know that the "truth" is not a purely linear relationship with normally-distributed errors. -- Does this mean our model is wrong? Yes, in some sense. -- Does this mean our model is bad? No, not necessarily! If we consider a linear model only to be a rough approximation, we can still make use of it for **statistical prediction**! --- layout: true # Test Error --- .middler-nocent[ **Training data:** data we use to train/fit our model (everything we've seen so far) **Test data:** data we use to evaluate/test the performance of our model ] --- Suppose we have training data `\(X_{i1}, \ \ldots,\ X_{ip}, Y_i, \ i = 1,\ldots,n\)` which we use to estimate regression coefficents `\(\hat\beta_0, \ \hat\beta_1, \ldots \hat\beta_p\)` (Recall: we use `\(\hat{}\)` "hats" to indicate **estimates**) Now suppose we are given new testing data `\(X^*_1, \ \ldots, X^*_{p}\)` and asked to predict the associated `\(Y^∗\)`. Using our estimated linear model, the prediction is: `$$\hat{Y}^* = \hat\beta_0 + \hat{\beta}_1 X^*_1 + \cdots + \hat{\beta}_p X^*_p$$` --- Given our prediction `$$\hat{Y} = \hat\beta_0 + \hat{\beta}_1 X^*_1 + \cdots + \hat{\beta}_p X^*_p$$` We define the **test error**, or **prediction error**, as `$$\mathbb{E}[(Y^* -\hat{Y}^*)^2].$$` In other words, the test error is defined as the expected squared difference between a new prediction and the truth!1 .footnote[[1] where the expectation is taken over all random training and test data.] --- **Test Error:** `\(\mathbb{E}[(Y^* -\hat{Y}^*)^2],\)` the expected squared difference between a new prediction and the truth. The test error would make a great way to assess the predictive power of our model! However, how do we estimate it? We don't know the value of that expectation, so somehow we have to use our data to estimate it in order to use it to assess our model. This provides us with a tool for * **predictive assessment:** an understanding of the magnitude of errors we should expect when making future predictions * **model/method selection:** choose among multiple choices of model based on minimizing test error --- layout: false layout: true # Training Error --- A natural estimator for the test error might be the observed average **training error:** `$$\dfrac{1}{n}\sum_{i=1}^n (Y_i - \hat{Y}_i)^2.$$` Can you think of a problem with this approach? --- `$$\dfrac{1}{n}\sum_{i=1}^n (Y_i - \hat{Y}_i)^2.$$` Can you think of a problem with this approach? In general, this will be *too optimistic*. Why? We chose estimates `\(\hat{\beta}_0,\ \ldots,\ \hat{\beta}_p\)` based on our training data! More specifically (with a linear regression model), we chose estimates *such that* they minimize the error from our training data. We cannot expect this error rate to generalize to test data. Critically, the more complex our model, the more optimistic our training data will be as an estimate for our test data! --- layout: false layout: true # Training Error vs Test Error Examples --- ```r library(ggpubr) # generate data set.seed(302) n <- 30 x <- sort(runif(n, -3, 3)) y <- 2*x + 2*rnorm(n) x_test <- sort(runif(n, -3, 3)) y_test <- 2*x_test + 2*rnorm(n) df_train <- data.frame("x" = x, "y" = y) df_test <- data.frame("x" = x_test, "y" = y_test) # store a theme my_theme <- theme_bw(base_size = 16) + theme(plot.title = element_text(hjust = 0.5, face = "bold"), plot.subtitle = element_text(hjust = 0.5)) # generate plots g_train <- ggplot(df_train, aes(x = x, y = y)) + geom_point() + xlim(-3, 3) + ylim(min(y, y_test), max(y, y_test)) + labs(title = "Training Data") + my_theme g_test <- ggplot(df_test, aes(x = x, y = y)) + geom_point() + xlim(-3, 3) + ylim(min(y, y_test), max(y, y_test)) + labs(title = "Test Data") + my_theme ggarrange(g_train, g_test) # from ggpubr, to put side-by-side ``` --- .middler[  ] --- ```r # Fit linear model and calculate training error lm_fit <- lm(y ~ x, data = df_train) yhat_train <- predict(lm_fit) # (y_i - yhat_i)^2 train_err <- mean((df_train$y - yhat_train)^2) # Calculate testing error yhat_test <- predict(lm_fit, data.frame(x = df_test$x)) test_err <- mean((df_test$y - yhat_test)^2) # Add linear model and error text to plot g_train2 <- g_train + labs(subtitle = paste("Training error:", round(train_err, 3))) + geom_line(aes(y = fitted(lm_fit)), col = "red", lwd = 1.5) g_test2 <- g_test + labs(subtitle = paste("Test error:", round(test_err, 3))) + geom_line(aes(y = fitted(lm_fit), x = df_train$x), col = "red", lwd = 1.5) ggarrange(g_train2, g_test2) ``` --- ## Degree 1 Model .middler[  ] --- ```r # Fit 5 degree polynomial and calculate training error lm_fit_5 <- lm(y ~ poly(x, 5), data = df_train) yhat_train_5 <- predict(lm_fit_5) train_err_5 <- mean((df_train$y - yhat_train_5)^2) # Calculate testing error yhat_test_5 <- predict(lm_fit_5, data.frame(x = df_test$x)) test_err_5 <- mean((df_test$y - yhat_test_5)^2) # Create smooth line for plotting x_fit <- data.frame(x = seq(-3, 3, length = 100)) line_fit <- data.frame(x = x_fit, y = predict(lm_fit_5, newdata = x_fit)) # Add linear model and error text to plot g_train3 <- g_train + labs(subtitle = paste("Training error:", round(train_err_5, 3))) + geom_line(data = line_fit, aes(y = y, x = x), col = "red", lwd = 1.5) g_test3 <- g_test + labs(subtitle = paste("Test error:", round(test_err_5, 3))) + geom_line(data = line_fit, aes(y = y, x = x), col = "red", lwd = 1.5) ggarrange(g_train3, g_test3) ``` --- ## Degree 5 Model .middler[  ] --- ```r # Fit 10 degree polynomial and calculate training error lm_fit_10 <- lm(y ~ poly(x, 10), data = df_train) yhat_train_10 <- predict(lm_fit_10) train_err_10 <- mean((df_train$y - yhat_train_10)^2) # Calculate testing error yhat_test_10 <- predict(lm_fit_10, data.frame(x = df_test$x)) test_err_10 <- mean((df_test$y - yhat_test_10)^2) # Create smooth line for plotting x_fit <- data.frame(x = seq(-3, 3, length = 100)) line_fit <- data.frame(x = x_fit, y = predict(lm_fit_10, newdata = x_fit)) # Add linear model and error text to plot g_train4 <- g_train + labs(subtitle = paste("Training error:", round(train_err_10, 3))) + geom_line(data = line_fit, aes(y = y, x = x), col = "red", lwd = 1.5) g_test4 <- g_test + labs(subtitle = paste("Test error:", round(test_err_10, 3))) + geom_line(data = line_fit, aes(y = y, x = x), col = "red", lwd = 1.5) ggarrange(g_train4, g_test4) ``` --- ## Degree 10 Model .middler[  ] --- ```r # Fit 15 degree polynomial and calculate training error lm_fit_15 <- lm(y ~ poly(x, 15), data = df_train) yhat_train_15 <- predict(lm_fit_15) train_err_15 <- mean((df_train$y - yhat_train_15)^2) # Calculate testing error yhat_test_15 <- predict(lm_fit_15, data.frame(x = df_test$x)) test_err_15 <- mean((df_test$y - yhat_test_15)^2) # Create smooth line for plotting x_fit <- data.frame(x = seq(-3, 3, length = 100)) line_fit <- data.frame(x = x_fit, y = predict(lm_fit_15, newdata = x_fit)) # Add linear model and error text to plot g_train5 <- g_train + labs(subtitle = paste("Training error:", round(train_err_15, 3))) + geom_line(data = line_fit, aes(y = y, x = x), col = "red", lwd = 1.5) g_test5 <- g_test + labs(subtitle = paste("Test error:", round(test_err_15, 3))) + geom_line(data = line_fit, aes(y = y, x = x), col = "red", lwd = 1.5) ggarrange(g_train5, g_test5) ``` --- ## Degree 15 Model .middler[  ] --- layout: false layout: true # Bias-Variance Tradeoff --- .middler-nocent[ The formula for test error can be decomposed as a function of the bias and variance of our estimates. * **Bias:** the expected difference between our estimate and the truth * **Variance:** the variability of our estimate of the truth ] --- .center[] Image Credit: An Introduction to Statistical Learning by Gareth James, Daniela Witten, Trevor Hastie, Robert Tibshirani --- .middler-nocent[ * **Bias:** underfitting, error from missing relevant relationships * **Variance:** overfitting, error from high sensitivity ] --- .middler[] .footnote[[Image Source](https://medium.com/greyatom/what-is-underfitting-and-overfitting-in-machine-learning-and-how-to-deal-with-it-6803a989c76)] --- .middler[] .footnote[[Image Source](https://medium.com/greyatom/what-is-underfitting-and-overfitting-in-machine-learning-and-how-to-deal-with-it-6803a989c76)] --- It is easy to fit a model with extremely low variance and extremely high bias, or extremely low bias and extremely high variance, but these models will not have a good test error. Ideally, we would like an estimate that has both low bias and low variance, but this is not always possible! As a general rule of thumb, as we increase the complexity of our model, the bias will decrease but the variance will increase. You can think of our bias decreasing because we are training our model to be more specific to our training data. You can think of the variance increasing because our model will be overfit, and will vary substantially with new training data. --- layout: false class: inverse .sectionhead[Part 2. Cross-validation] --- layout: true # Sample-splitting --- Where do we get our "training data" and our "test data" in practice? We can't just simulate more data for our test data in the real world. In practice, we use a technique called **sample-splitting:** 1. Split the data set into two (or more...) parts 2. First part of data: train the model/method 3. Second part of data: make predictions 4. Evaluate observed test error --- ```r # Generate data set.seed(302) n <- 50 x <- sort(runif(n, -3, 3)) y <- 2*x + 2*rnorm(n) # Randomly split data into two parts inds <- sample(rep(1:2, length = n)) split <- as.factor(inds) %>% fct_recode(Training = "1", Test = "2") data <- data.frame("x" = x, "y" = y, "split" = split) g_split <- ggplot(data, aes(x = x, y = y, color = split)) + geom_point() + labs(title = "Sample-splitting") + my_theme g_split ``` ---  --- ```r # Train on the training split data_train <- data %>% filter(split == "Training") lm_1 <- lm(y ~ x, data = data_train) lm_10 <- lm(y ~ poly(x, 10), data = data_train) # Predict on the second half data_test <- data %>% filter(split == "Test") pred_1 <- predict(lm_1, data.frame(x = data_test$x)) pred_10 <- predict(lm_10, data.frame(x = data_test$x)) # Calculate test error test_err_1 <- mean((data_test$y - pred_1)^2) test_err_10 <- mean((data_test$y - pred_10)^2) ``` --- ```r # Create smooth lines for plotting x_fit <- data.frame(x = seq(min(data$x), max(data$x), length = 100)) line_fit_1 <- data.frame(x = x_fit, y = predict(lm_1, newdata = x_fit)) line_fit_10 <- data.frame(x = x_fit, y = predict(lm_10, newdata = x_fit)) # Add linear model and error text to plot g_split1 <- g_split + labs(subtitle = paste("Degree 1 Test error:", round(test_err_1, 3))) + geom_line(data = line_fit_1, aes(y = y, x = x), col = "black", lwd = 1.5) g_split10 <- g_split + labs(subtitle = paste("Degree 10 Test error:", round(test_err_10, 3))) + geom_line(data = line_fit_10, aes(y = y, x = x), col = "black", lwd = 1.5) ggarrange(g_split1, g_split10, common.legend = TRUE, legend = "bottom") ``` ---  --- Sample-splitting gives us a powerful tool to evaluate the performance of estimator *on data that was not used to train it*! Of course, this comes at the cost of sacrificing some of our data that could be used in order to train a model with as much information as possible, but this is a sacrifice we must make in practice if we want to appropriately evaluate the predictive performance of our models/methods! However, we can do better than just splitting our data in half. --- layout: false layout: true # k-fold Cross-validation --- In general, the process of `\(k\)`-fold cross-validation is as follows: 1. Split data into `\(k\)` parts (folds) 2. Use all but 1 fold as your training data and fit the model 3. Use the remaining fold for your test data and make predictions 4. Switch which fold is your test data and repeat steps 2 and 3 until all folds have been test data (k times) 5. Compute squared error Commonly, we use `\(k=5\)` and `\(k=10\)`. --- .middler[] --- For each split, we calculate the out-of-sample test error, also known as the **mean squared error (MSE)**. For example, for the first split, we calculate `$$MSE_1 = \dfrac{1}{m}\sum_{j = 1}^{m} (Y_{j,test} - \hat{Y}_{j,test})^2,$$` where `\(m\)` is the number of observations in the test set. Then we calculate the **cross-validation estimate** of our test error `$$CV_{(k)} = \dfrac{1}{k}\sum_{i=1}^{k}MSE_i.$$` In words, our cross-validation estimate of the test error is the average of the mean squared errors across the splits! --- ## Leave-One-Out Cross-Validation Leave-one-out cross-validation (LOOCV) is a special instance of `\(k\)`-fold cross-validation where `\(k\)` is equal to the sample size `\(n\)`. This means you fit `\(n\)` different models using `\(n-1\)` data points for your training data, and then test on the remaining individual data point. --- ## Bias-variance Tradeoff LOOCV strengths in that it uses as much data as possible to train the model while still having out-of-sample test data. Thus, it will provide approximately unbiased estimates of the test error, and is the best choice for minimizing bias. However, LOOCV has one major drawback: variance. Because it fits `\(n\)` models, each of which is trained on almost identical training data, the outputs of the models are highly correlated. All other things being equal, the mean of correlated observations has a higher variance than the mean of uncorrelated observations. Thus, LOOCV has higher variance than `\(k\)`-fold CV with `\(k<n\)`. As a rule of thumb, stick to `\(k=5\)` and `\(k=10\)`. These values tend to result in an ideal balance in terms of the bias-variance tradeoff. --- ## What to do after cross-validation? We use cross-validation as a method to evaluate our model, *not* to build our model! Thus, once we have used `\(k\)`-fold cross-validation to come up with a reasonable estimate of our out-of-sample test-error (and perhaps to choose among several models based on this test error), we use the *full* data to train our final predictive model. Thus, using cross-validation, we are able to build a model based on our full data, and still evaluate the performance of our model on out-of-sample data! --- layout: false layout: true # k-fold Cross-validation Example --- ```r set.seed(302) # Split data in 5 parts, randomly k <- 5 inds <- sample(rep(1:k, length = n)) # Use data from before data <- data.frame("x" = x, "y" = y, "split" = inds) # Empty matrix to store predictions, 2 columns for 2 models pred_mat <- matrix(NA, n, 2) for (i in 1:k) { data_train <- data %>% filter(split != i) data_test <- data %>% filter(split == i) # Train our models lm_1_cv <- lm(y ~ x, data = data_train) lm_10_cv <- lm(y ~ poly(x, 10), data = data_train) # Record predictions pred_mat[inds == i, 1] <- predict(lm_1_cv, data.frame(x = data_test$x)) pred_mat[inds == i, 2] <- predict(lm_10_cv, data.frame(x = data_test$x)) } # Compute average MSE to get CV error cv_err <- colMeans((pred_mat - data$y)^2) ``` --- ```r # Create predictive model lm_1 <- lm(y ~ x, data = data) lm_10 <- lm(y ~ poly(x, 10), data = data) # Create smooth lines for plotting x_fit <- data.frame(x = seq(min(data$x), max(data$x), length = 100)) line_fit_1 <- data.frame(x = x_fit, y = predict(lm_1, newdata = x_fit)) line_fit_10 <- data.frame(x = x_fit, y = predict(lm_10, newdata = x_fit)) # Recode split for legend data <- data %>% mutate(Fold = fct_recode(as.factor(split), "Fold 1" = "1", "Fold 2" = "2", "Fold 3" = "3", "Fold 4" = "4", "Fold 5" = "5")) g_cv <- ggplot(data, aes(x = x, y = y, color = Fold)) + geom_point() + labs(title = "Cross-validation") + my_theme g_cv1 <- g_cv + labs(subtitle = paste("Degree 1 CV error:", round(cv_err[1], 3))) + geom_line(data = line_fit_1, aes(y = y, x = x), col = "black", lwd = 1.5) g_cv10 <- g_cv + labs(subtitle = paste("Degree 10 CV error:", round(cv_err[2], 3))) + geom_line(data = line_fit_10, aes(y = y, x = x), col = "black", lwd = 1.5) ggarrange(g_cv1, g_cv10, common.legend = TRUE, legend = "bottom") ``` ---  --- layout: false class: inverse .sectionhead[Part 3. Statistical Prediction Algorithms] --- # Statistical Prediction Algorithms We've talked about how regression can be used for both statistical inference and prediction. We are now going to shift to talk about algorithms designed specifically for statistical prediction. We will discuss only a few methods for this course to teach you about the principles of how they work. This will serve as an introduction to topics you may encounter if you venture further into fields such as **machine learning**. --- # Statistical Prediction Algorithms The normal distribution, specified by parameters for the mean and the variance, is an example of a **parametric model**. We are now going to discuss some **non-parametric models**. As the name implies, these models have no parameters at all. Non-parametric models are not motivated by assuming a distribution about the data. Instead, the focus is often on pure prediction. How can we use data to help us classify and predict the world around us? For the most part, many of these methods would have been impossible before the rise of high-powered computing. --- layout: true # k-nearest neighbors --- k-nearest neighbors is a non-parametric prediction algorithm. * **Input:** training data `\(X_i = (X_{i1}, \ldots, X_{ip})\)` and output class `\(Y_i\)` for `\(i = 1,\ldots, n\)` * **Input:** test data `\(X^* = (X^*_1, \ldots, X^*_p)\)` with unknown output class `\(Y^*\)` * **Algorithm:** Find `\(X_{(1)},\ldots, X_{(k)}\)`, the `\(k\)` nearest points to `\(X^*\)` * **Output:** Predicted class `\(\hat{Y}^*\)`, the most common class from `\(X_{(1)},\ldots, X_{(k)}\)` This method is simple and highly flexible, but it can also be slow and inappropriate for certain settings. --- .middler[  [Video source](http://blog.datacamp.com/machine-learning-in-r/) ] --- .middler[ Image Credit: An Introduction to Statistical Learning by Gareth James, Daniela Witten, Trevor Hastie, Robert Tibshirani ] --- .middler[ Image Credit: An Introduction to Statistical Learning by Gareth James, Daniela Witten, Trevor Hastie, Robert Tibshirani ] --- ## Choosing k What happens when `\(k=1\)`? `\(k = n\)`? In order to choose an "optimal" `\(k\)`, it is common to use cross-validation: * For `\(k=1,\ldots,n\)` (or a more restrictive range), fit `\(k\)`-nearest neighbors * Use cross-validation to identify `\(k\)` with the minimum test error * Re-train a `\(k\)`-nearest neighbor model using all the data with optimal choice of `\(k\)` Cross-validation is a great tool to choose values for tuning parameters across a number of algorithms, not just `\(k\)`-nearest neighbors! --- .middler[ Test error is minimized at about `\(k=10\)`. Image Credit: An Introduction to Statistical Learning by Gareth James, Daniela Witten, Trevor Hastie, Robert Tibshirani ] --- layout: false layout: true # Trees --- Instead of classifying based on neighboring data points in the training data, we can classify based on splits in our covariates. * **Input:** training data `\(X_i = (X_{i1}, \ldots, X_{ip})\)` and output class/value `\(Y_i\)` for `\(i = 1,\ldots, n\)` * **Input:** test data `\(X^* = (X^*_1, \ldots, X^*_p)\)` with unknown output class/value `\(Y^*\)` * **Algorithm:** Identify splits in `\(X_i\)` that best predict `\(Y_i\)` * **Output:** Predicted class/value `\(\hat{Y}^*\)` using splits Trees to predict class are referred to as **classification trees**. Trees to predict quantitative output are referred to as **regression trees**. This algorithm is easy, efficient, and interpretable, but it is not as flexible as `\(k\)`-nearest neighbors. --- .middler[ [Image source](http://www.stat.cmu.edu/~ryantibs/statcomp/lectures/prediction.html) ] --- ## Random Forest In practice, we don't typically predict with a single tree. Instead, we combine multiple trees and take the average/most common of their predictions. Keeping with the tree metaphor, this is referred to as the **random forest** algorithm. .center[ [Image source](https://towardsdatascience.com/random-forests-and-decision-trees-from-scratch-in-python-3e4fa5ae4249)] --- ## Random Forest In practice, we don't typically predict with a single tree. Instead, we combine multiple trees and take the average/most common of their predictions. Keeping with the tree metaphor, this is referred to as the **random forest** algorithm. .center[ [Image source](https://towardsdatascience.com/understanding-random-forest-58381e0602d2)] --- ## Variable Importance One major benefit of tree-based prediction algorithms is that they provide a powerful and interpretable tool for assessing **variable importance**. For example, we can look across all trees in a random forest, assess how often variables were used for splitting and how helpful those splits were for prediction, and identify the variables that improve our predictions the most! (For more on this, see the *Gini index*. I highly recommend the book I've been using for some of these images, "An Introduction to Statistical Learning" by Gareth James, Daniela Witten, Trevor Hastie, Robert Tibshirani.) --- layout: false # Statistical Prediction Algorithms This was a very brief overfiew of a very small subset of the algorithms used for statistical prediction. Other common examples include: * neural networks, * support vector machines, * kernel classifiers, * Bayesian classifiers,
 `\(\ \ \ \ \ \ \ \vdots\)` These algorithms, and related topics, are likely things that you will cover if you take courses more focused on machine learning.


Examples
Too many words. Just show me.
These are some templates that are used in the unit tests. They all output a properties file (and the tests check the properties they output). You
may want to checkout the source and see what the tests are doing, too.
- testBasicExample (Freemarker, Jelly): outputs a bunch of interesting properties of a source base
- testForAllPackages (Freemarker, Jelly): iterates through all the packages of a source base
- testForAllTypes (Freemarker, Jelly): iterates through all types of annotated by a specific annotation
- testPropertyName (Freemarker, Jelly): utilizes the decorations on a method for property naming
- testIncludeSuperclasses (Freemarker, Jelly): iterates through a bunch of methods including superclasses
- testIfHasAnnotation (Freemarker, Jelly): example for testing whether a declaration has an annotation and for outputting an annotation value
|


the person traveling uploads their trip's information i.e. airline, date and time of flight, how much space they have available in kilograms, and how much they want for each kg
the package owner browses through listed trips and requests to book space on a trip by submitting information about the package e.g. a list of the contents in package, the contact person (receiver or sender), package weight, type of space they'd like to book i.e. carry-on or checked-in
when the courier approves a package, the package owner gets a notification asking them or their contact person to bring the package over to the package office for checking. Once the package is checked in their presence and verified to not contain drugs or other contraband, the package owner pays the service fee in full. the courier then gets a notification asking them to pick up the package before their due flight.
when the courier lands, they drop the package off at the country's package office where it's checked (to verify contents integrity) in the presence of the courier. once all the contents are accounted for, the courier receives payment for their service either in cash or via a bank deposit. the package owner or the contact person is then notified within the app to pick up their package
Designer
Developer
Developer


Viagra 2.0: Monitor lizard's blood mixed with rum
by Akhil KadidalThe arrest of a wildlife trafficker trying to sell a live monitor lizard in the city on Saturday has shed light on a trade in which animals are allegedly killed to create a Viagra elixir to treat sexual dysfunction in men.
A senior wildlife activist who tipped off the forest department said the monitor lizard trade had surged in recent times, with many of the animals being transported into Bengaluru on weekends.
Although some of the animals are sold as bushmeat to restaurants as revealed by the arrest of a man caught with four lizards in his possession on October 17, evidence now suggests that some lizards are being killed for other purposes.
“Their blood is being mixed in rum which is then sold as a sort of Viagra, mainly to the IT and real estate clientele,” the activist said.
The activist added that there was no basis of any kind that the blood of these lizards had medicinal properties.
The arrested man was identified as 29-year-old Chinna, a member of the Hakki Pikki tribal community in Kolar. He was found with a single, live lizard in his possession.
Forest officials said Chinna has had previous run-ins with the law for other illegalities. Among these was a stint as a professional monkey catcher, an illegal occupation which Chinna proudly advertised on business cards carrying his name and phone number.
On Saturday morning, however, Chinna’s escapades came to an end at KR Puram, in front of Sri Vinayaka Jewellers, when he was arrested by members of the Forest Vigilance Squad, following information from Traffic, the international NGO which monitors the illegal trade in wild animals. The raid was led by Deputy Conservator of Forests G A Gangadhar.
The lizard is now recovering at the Wildlife Rescue and Rehabilitation Centre, Bannerghatta. Chinna told forest officials that he had captured the creature along the Andhra Pradesh-Tamil Nadu border.


Venice flooding at historic levels during high tide
by Rachael KennedyVenice declared a state of emergency on Wednesday after "apocalyptic" floods swept through the lagoon city, flooding its historic basilica and inundating squares and centuries-old buildings.
"These are the effects of climate change," the Venice mayor, Luigi Brugano, wrote on Twitter on Tuesday night.
"Venice is on its knees," Brugnaro added on Wednesday. "The damage will run into hundreds of millions of euros."
Watch Euronews' coverage in the video player above.
According to Brugano, the tide from Monday evening hit 187cm, which is just short of the overall record of 194cm set in 1966.
He said schools on the city's islands would also remain closed on Wednesday as another high tide of up to 145cm was forecast for later in the morning.
Pictures of the historic city showed many iconic places, such as Saint Mark's Square and Saint Mark's Basilica, underwater.
It is the sixth time in 1,200 years that the basilica has been flooded, with four of those incidents happening in the last two decades.
Meanwhile, tourists were pictured wading through knee-deep water along the city's most popular routes, while others braved the flooding to sit outside the city's famous cafes.
"A tide at 187 cm is a wound that leaves indelible marks," Brugano wrote in a later post. "Now the government must listen to Venezia."
Venetians and local business owners have been asked to take a record of all the damages to their homes and businesses as a plan of action is written up.


Welcome
Hi there, I’m a data scientist and this is my personal blog about Data Science
. I’m a former accountant who have found real passion and strength in data science and I’ve taught myself to become a data scientist without any related degrees. Here I share my own curriculum covering from the basics of computer science to the state-of-the-art machine learning techniques. Below are the materials I used to learn. Tutorials are available above.
How I’ve taught myself
Online Courses
- Machine Learning by Andrew Ng(Stanford University) - My Certificate
- Deep Learning Specialization by Andrew Ng(deeplearning.ai) - My Certificate
- Stanford University CS231n : Convolutional Neural Networks for Visual Recognition
- DataCamp
- Google Machine Learning Crash Course
- Khan Academy
Books
- Hands-on Machine Learning with Scikit-Learn and TensorFlow - by Aurélien Géron
- Deep Learning from Scratch - by Saito Goki
- Deep Learning with Python - by François Chollet
- Introduction to Machine Learning with Python - by Andreas C. Müller, Sarah Guido
- Deep Learning Cookbook - by Douwe Osinga
- TensorFlow Deep Learning Projects - by Luca Massaron, Rajalingappaa Shanmugamani, Alberto Boschetti, Alexey Grigorev, Abhishek Thakur
- Spark: The Definitive Guide - by Bill Chambers, Matei Zaharia
If you like my things and wanna chat with me over projects, work opportunities, collaboration, or just chitchat, Shoot me an email at<EMAIL_ADDRESS>💝 Any feedback would be greatly appreciated! 🙏


par(1) USER COMMANDS par(1) NAME par - filter for reformatting paragraphs SYNOPSIS par [ help ] [ version ] [ Bopset ] [ Popset ] [ Qopset ] [ h[hang] ] [ p[prefix] ] [ r[repeat] ] [ s[suffix] ] [ T[Tab] ] [ w[width] ] [ b[body] ] [ c[cap] ] [ d[div] ] [ E[Err] ] [ e[expel] ] [ f[fit] ] [ g[guess] ] [ j[just] ] [ l[last] ] [ q[quote] ] [ R[Report] ] [ t[touch] ] DESCRIPTION par is a filter which copies its input to its output, changing all white characters (except newlines) to spaces, and reformatting each paragraph. Paragraphs are separated by protected, blank, and bodiless lines (see the TERMINOLOGY section for definitions), and optionally delimited by inden‐ tation (see the d option in the OPTIONS section). Each output paragraph is generated from the corresponding input paragraph as follows: 1) An optional prefix and/or suffix is removed from each input line. 2) The remainder is divided into words (separated by spaces). 3) The words are joined into lines to make an eye-pleasing paragraph. 4) The prefixes and suffixes are reattached. If there are suffixes, spaces are inserted before them so that they all end in the same column. QUICK START par is necessarily complex. For those who wish to use it immediately and understand it later, assign the PARINIT environment variable the follow‐ ing value: rTbgqR B=.,?_A_a Q=_s>| The spaces, question mark, greater-than sign, and vertical bar will prob‐ ably have to be escaped or quoted to prevent your shell from interpreting them. The documentation, though precise, is unfortunately not well-written for the end-user. Your best bet is probably to read quickly the DESCRIPTION, TERMINOLOGY, OPTIONS, and ENVIRONMENT sections, then read carefully the EXAMPLES section, referring back to the OPTIONS and TERMINOLOGY sections as needed. For the "power user", a full understanding of par will require multiple readings of the TERMINOLOGY, OPTIONS, DETAILS, and EXAMPLES sections. TERMINOLOGY Miscellaneous terms: charset syntax A way of representing a set of characters as a string. The set includes exactly those characters which appear in the string, except that the underscore (_) is an escape charac‐ ter. Whenever it appears, it must begin one of the follow‐ ing escape sequences: __ = an underscore _s = a space _b = a backslash (\) _q = a single quote (') _Q = a double quote (") _A = all upper case letters _a = all lower case letters _0 = all decimal digits _xhh = the character represented by the two hexadecimal digits hh (which may be upper or lower case) The NUL character must not appear in the string, but it may be included in the set with the _x00 sequence. error A condition which causes par to abort. See the DIAGNOSTICS section. IP Input paragraph. OP Output paragraph. parameter A symbol which may take on unsigned integral values. There are several parameters whose values affect the behavior of par. Parameters can be assigned values using command line options. Types of characters: alphanumeric character An upper case letter, lower case letter, or decimal digit. body character A member of the set of characters defined by the PARBODY environment variable (see the ENVIRONMENT section) and/or the B option (see the OPTIONS section). protective character A member of the set of characters defined by the PARPRO‐ TECT environment variable and/or the P option. quote character A member of the set of characters defined by the PARQUOTE environment variable and/or the Q option. terminal character A period, question mark, exclamation point, or colon. white character A space, formfeed, newline, carriage return, tab, or verti‐ cal tab. Functions: comprelen Given a non-empty sequence S of lines, let c be their long‐ est common prefix. If the parameter body is 0, place a divider just after the leading non-body characters in c (at the beginning if there are none). If body is 1, place the divider just after the last non-space non-body character in c (at the beginning if there is none), then advance the divider over any immediately following spaces. The compre‐ len of S is the number of characters preceding the divider. comsuflen Given a non-empty sequence S of lines, let p be the compre‐ len of S. Let T be the set of lines which result from stripping the first p characters from each line in S. Let c be the longest common suffix of the lines in T. If body is 0, place a divider just before the trailing non-body characters in c (at the end if there are none), then advance the divider over all but the last of any immedi‐ ately following spaces. If body is 1, place the divider just before the first non-space non-body character, then back up the divider over one immediately preceding space if there is one. The comsuflen of S is the number of charac‐ ters following the divider. fallback prelen (suflen) The fallback prelen (suflen) of an IP is: the comprelen (comsuflen) of the IP, if the IP contains at least two lines; otherwise, the comprelen (comsuflen) of the block containing the IP, if the block contains at least two lines; otherwise, the length of the longer of the prefixes (suffixes) of the bodiless lines just above and below the block, if the segment containing the block has any bodiless lines; otherwise, 0. (See below for the definitions of block, segment, and bodiless line.) augmented fallback prelen Let fp be the fallback prelen of an IP. If the IP contains more than one line, or if quote is 0, then the augmented fallback prelen of the IP is simply fp. Otherwise, it is fp plus the number of quote characters immediately follow‐ ing the first fp characters of the line. quoteprefix The quoteprefix of a line is the longest string of quote characters appearing at the beginning of the line, after this string has been stripped of any trailing spaces. Types of lines: blank line An empty line, or a line whose first character is not pro‐ tective and which contains only spaces. protected line An input line whose first character is protective. bodiless line A line which is order k bodiless for some k. order k bodiless line There is no such thing as an order 0 bodiless line. Sup‐ pose S is a a contiguous subsequence of a segment (see below) containing at least two lines, containing no order k-1 bodiless lines, bounded above and below by order k-1 bodiless lines and/or the beginning/end of the segment. Let p and s be the comprelen and comsuflen of S. Any mem‐ ber of S which, if stripped of its first p and last s char‐ acters, would be blank (or, if the parameter repeat is non- zero, would consist of the same character repeated at least repeat times), is order k bodiless. The first p characters of the bodiless line comprise its prefix; the last s char‐ acters comprise its suffix. The character which repeats in the middle is called its repeat character. If the middle is empty, the space is taken to be its repeat character. vacant line A bodiless line whose repeat character is the space. superfluous line Only blank and vacant lines may be superfluous. If con‐ tiguous vacant lines lie at the beginning or end of a seg‐ ment, they are all superfluous. But if they lie between two non-vacant lines within a segment, then all are super‐ fluous except one—the one which contains the fewest non- spaces. In case of a tie, the first of the tied lines is chosen. Similarly, if contiguous blank lines lie outside of any segments at the beginning or end of the input, they are all superfluous. But if they lie between two segments and/or protected lines, then all are superfluous except the first. Groups of lines: segment A contiguous sequence of input lines containing no pro‐ tected or blank lines, bounded above and below by protected lines, blank lines, and/or the beginning/end of the input. block A contiguous subsequence of a segment containing no bodi‐ less lines, bounded above and below by bodiless lines and/or the beginning/end of the segment. Types of words: capitalized word If the parameter cap is 0, a capitalized word is one which contains at least one alphanumeric character, whose first alphanumeric character is not a lower case letter. If cap is 1, every word is considered a capitalized word. (See the c option in the OPTIONS section.) curious word A word which contains a terminal character c such that there are no alphanumeric characters in the word after c, but there is at least one alphanumeric character in the word before c. OPTIONS Any command line argument may begin with one minus sign (-) which is ignored. Generally, more than one option may appear in a single command line argument, but there are exceptions: The help, version, B, P, and Q options must have whole arguments all to themselves. help Causes all remaining arguments to be ignored. No input is read. A usage message is printed on the output briefly describing the options used by par. version Causes all remaining arguments to be ignored. No input is read. "par 1.52" is printed on the output. Of course, this will change in future releases of Par. Bopset op is a single character, either an equal sign (=), a plus sign (+), or a minus sign (-), and set is a string using charset syntax. If op is an equal sign, the set of body characters is set to the character set defined by set. If op is a plus/minus sign, the characters in the set defined by set are added/removed to/from the existing set of body characters defined by the PARBODY environment variable and any previous B options. It is okay to add characters that are already in the set or to remove characters that are not in the set. Popset Just like the B option, except that it applies to the set of protective characters. Qopset Just like the B option, except that it applies to the set of quote characters. All remaining options are used to set values of parameters. Values set by command line options hold for all paragraphs. Unset parameters are given default values. Any parameters whose default values depend on the IP (namely prefix and suffix), if left unset, are recomputed separately for each paragraph. The approximate role of each variable is described here. See the DETAILS section for the rest of the story. The first six parameters, hang, prefix, repeat, suffix, Tab, and width, may be set to any unsigned decimal integer less than 10000. h[hang] Mainly affects the default values of prefix and suffix. Defaults to 0. If the h option is given without a number, the value 1 is inferred. (See also the p and s options.) p[prefix] The first prefix characters of each line of the OP are copied from the first prefix characters of the corresponding line of the IP. If there are more than hang+1 lines in the IP, the default value is the comprelen of all the lines in the IP except the first hang of them. Otherwise, the default value is the augmented fallback prelen of the IP. If the p option is given without a number, prefix is unset, even if it had been set earlier. (See also the h and q options.) r[repeat] If repeat is non-zero, bodiless lines have the number of instances of their repeat characters increased or decreased until the length of the line is width. The exact value of repeat affects the definition of bodiless line. Defaults to 0. If the r option is given without a number, the value 3 is inferred. (See also the w option.) s[suffix] The last suffix characters of each line of the OP are copied from the last suffix characters of the corresponding line of the IP. If there are more than hang+1 lines in the IP, the default value is the comsuflen of all the lines of the IP except the first hang of them. Otherwise, the default value is the fallback suflen of the IP. If the s option is given with‐ out a number, suffix is unset, even if it had been set earlier. (See also the h option.) T[Tab] Tab characters in the input are expanded to spaces, assuming tab stops every Tab columns. Must not be 0. Defaults to 1. If the T option is given without a number, the value 8 is inferred. w[width] No line in the OP may contain more than width characters, not including the trailing newlines. Defaults to 72. If the w option is given without a number, the value 79 is inferred. The remaining thirteen parameters, body, cap, div, Err, expel, fit, guess, invis, just, last, quote, Report, and touch, may be set to either 0 or 1. If the number is absent in the option, the value 1 is inferred. b[body] If body is 1, prefixes may not contain any trailing body char‐ acters, and suffixes may not contain any leading body charac‐ ters. (Actually, the situation is complicated by space charac‐ ters. See comprelen and comsuflen in the Terminology section.) If body is 0, prefixes and suffixes may not contain any body characters at all. Defaults to 0. c[cap] If cap is 1, all words are considered capitalized. This cur‐ rently affects only the application of the g option. Defaults to 0. d[div] If div is 0, each block becomes an IP. If div is 1, each block is subdivided into IPs as follows: Let p be the comprelen of the block. Let a line's status be 1 if its (p+1)st character is a space, 0 otherwise. Every line in the block whose status is the same as the status of the first line will begin a new paragraph. Defaults to 0. E[Err] If Err is 1, messages to the user (caused by the help and ver‐ sion options, or by errors) are sent to the error stream instead of the output stream. Defaults to 0. e[expel] If expel is 1, superfluous lines are withheld from the output. Defaults to 0. f[fit] If fit is 1 and just is 0, par tries to make the lines in the OP as nearly the same length as possible, even if it means mak‐ ing the OP narrower. Defaults to 0. (See also the j option.) g[guess] If guess is 1, then when par is choosing line breaks, whenever it encounters a curious word followed by a capitalized word, it takes one of two special actions. If the two words are sepa‐ rated by a single space in the input, they will be merged into one word with an embedded non-breaking space. If the two words are separated by more than one space, or by a line break, par will insure that they are separated by two spaces, or by a line break, in the output. Defaults to 0. i[invis] If invis is 1, then vacant lines inserted because quote is 1 are invisible; that is, they are not output. If quote is 0, invis has no effect. Defaults to 0. (See also the q option.) j[just] If just is 1, par justifies the OP, inserting spaces between words so that all lines in the OP have length width (except the last, if last is 0). Defaults to 0. (See also the w, l, and f options.) l[last] If last is 1, par tries to make the last line of the OP about the same length as the others. Defaults to 0. q[quote] If quote is 1, then before each segment is scanned for bodiless lines, par supplies vacant lines between different quotation nesting levels as follows: For each pair of adjacent lines in the segment, (scanned from the top down) which have different quoteprefixes, one of two actions is taken. If invis is 0, and either line consists entirely of quote characters and spaces (or is empty), that line is truncated to the longest common prefix of the two lines (both are truncated if both qualify). Otherwise, a line consisting of the longest common prefix of the two lines is inserted between them. quote also affects the default value of prefix. Defaults to 0. (See also the p and i options.) R[Report] If Report is 1, it is considered an error for an input word to contain more than L = (width - prefix - suffix) characters. Otherwise, such words are chopped after each Lth character into shorter words. Defaults to 0. t[touch] Has no effect if suffix is 0 or just is 1. Otherwise, if touch is 0, all lines in the OP have length width. If touch is 1, the length of the lines is decreased until the suffixes touch the body of the OP. Defaults to the logical OR of fit and last. (See also the s, j, w, f, and l options.) If an argument begins with a number, that number is assumed to belong to a p option if it is 8 or less, and to a w option otherwise. If the value of any parameter is set more than once, the last value is used. When unset parameters are assigned default values, hang and quote are assigned before prefix, and fit and last are assigned before touch (because of the dependencies). It is an error if width <= prefix + suffix. ENVIRONMENT PARBODY Determines the initial set of body characters (which are used for determining comprelens and comsuflens), using charset syn‐ tax. If PARBODY is not set, the set of body characters is ini‐ tially empty. PARINIT If set, par will read command line options from PARINIT before it reads them from the command line. Within the value of PARINIT, arguments are separated by white characters. PARPROTECT Determines the set of protective characters, using charset syn‐ tax. If PARPROTECT is not set, the set of protective charac‐ ters is initially empty. PARQUOTE Determines the set of quote characters, using charset syntax. If PARQUOTE is not set, the set of quote characters initially contains only the greater-than sign (>) and the space. If a NUL character appears in the value of an environment variable, it and the rest of the string will not be seen by par. Note that the PARINIT variable, together with the B, P, and Q options, renders the other environment variables unnecessary. They are included for backward compatibility. DETAILS Lines are terminated by newline characters, but the newlines are not con‐ sidered to be included in the lines. If the last character of the input is a non-newline, a newline will be inferred immediately after it (but if the input is empty, no newline will be inferred; the number of input lines will be 0). Thus, the input can always be viewed as a sequence of lines. Protected lines are copied unchanged from the input to the output. All other input lines, as they are read, have any NUL characters removed, and every white character (except newlines) turned into a space. Actually, each tab character is turned into Tab - (n % Tab) spaces, where n is the number of characters preceding the tab character on the line (evaluated after earlier tab characters have been expanded). Blank lines in the input are transformed into empty lines in the output. If repeat is 0, all bodiless lines are vacant, and they are all simply stripped of trailing spaces before being output. If repeat is not 0, only vacant lines whose suffixes have length 0 are treated that way; other bodiless lines have the number of instances of their repeat charac‐ ters increased or decreased until the length of the line is width. If expel is 1, superfluous lines are not output. If quote and invis are both 1, there may be invisible lines; they are not output. The input is divided into segments, which are divided into blocks, which are divided into IPs. The exact process depends on the values of quote and div (see q and d in the OPTIONS section). The remainder of this sec‐ tion describes the process which is applied independently to each IP to construct the corresponding OP. After the values of the parameters are determined (see the OPTIONS sec‐ tion), the first prefix characters and the last suffix characters of each input line are removed and remembered. It is an error for any line to contain fewer than prefix + suffix characters. The remaining text is treated as a sequence of characters, not lines. The text is broken into words, which are separated by spaces. That is, a word is a maximal sub-sequence of non-spaces. If guess is 1, some words might be merged (see g in the OPTIONS section). The first word includes any spaces that precede it on the same line. Let L = width - prefix - suffix. If Report is 0, some words may get chopped up at this point (see R in the OPTIONS section). The words are reassembled, preserving their order, into lines. If just is 0, adjacent words within a line are separated by a single space, (or sometimes two if guess is 1), and line breaks are chosen so that the paragraph satisfies the following properties: 1) No line contains more than L characters. 2) If fit is 1, the difference between the lengths of the shortest and longest lines is as small as possible. 3) The shortest line is as long as possible, subject to properties 1 and 2. 4) Let target be L if fit is 0, or the length of the longest line if fit is 1. The sum of the squares of the differences between target and the lengths of the lines is as small as possible, subject to properties 1, 2, and 3. If last is 0, the last line does not count as a line for the pur‐ poses of properties 2, 3, and 4 above. If all the words fit on a single line, the properties as worded above don't make much sense. In that case, no line breaks are inserted. If just is 1, adjacent words within a line are separated by one space (or sometimes two if guess is 1) plus zero or more extra spaces. The value of fit is disregarded, and line breaks are chosen so that the paragraph satisfies the following properties: 1) Every line contains exactly L characters. 2) The largest inter-word gap is as small as possible, subject to property 1. (An inter-word gap consists only of the extra spa‐ ces, not the regular spaces.) 3) The sum of the squares of the lengths of the inter-word gaps is as small as possible, subject to properties 1 and 2. If last is 0, the last line does not count as a line for the pur‐ poses of property 1, and it does not require or contain any extra spaces. Extra spaces are distributed as uniformly as possible among the inter-word gaps in each line. In a justified paragraph, every line must contain at least two words, but that's not always possible to accomplish. If the para‐ graph cannot be justified, it is considered an error. If the number of lines in the resulting paragraph is less than hang, empty lines are added at the end to bring the number of lines up to hang. If just is 0 and touch is 1, L is changed to be the length of the longest line. If suffix is not 0, each line is padded at the end with spaces to bring its length up to L. To each line is prepended prefix characters. Let n be the number of lines in the IP, let afp be the augmented fallback prelen of the IP, and let fs be the fallback suflen of the IP. The characters which are prepended to the ith line are chosen as follows: 1) If i <= n, the characters are copied from the ones that were removed from the beginning of the nth input line. 2) If i > n > hang, the characters are copied from the ones that were removed from the beginning of the last input line. 3) If i > n and n <= hang, the first min(afp,prefix) of the charac‐ ters are copied from the ones that were removed from the beginning of the last input line, and the rest are all spaces. Then to each line is appended suffix characters. The characters which are appended to the ith line are chosen as follows: 1) If i <= n, the characters are copied from the ones that were removed from the end of the nth input line. 2) If i > n > hang, the characters are copied from the ones that were removed from the end of the last input line. 3) If i > n and n <= hang, the first min(fs,suffix) of the characters are copied from the ones that were removed from the beginning of the last input line, and the rest are all spaces. Finally, the lines are printed to the output as the OP. DIAGNOSTICS If there are no errors, par returns EXIT_SUCCESS (see <stdlib.h>). If there is an error, an error message will be printed to the output, and par will return EXIT_FAILURE. If the error is local to a single para‐ graph, the preceding paragraphs will have been output before the error was detected. Line numbers in error messages are local to the IP in which the error occurred. All error messages begin with "par error:" on a line by itself. Error messages concerning command line or environment variable syntax are accompanied by the same usage message that the help option produces. Unless the option E is set, trying to print an error message would be futile if an error resulted from an output function, so par doesn't bother doing any error checking on output functions if E is 0. EXAMPLES The superiority of par's dynamic programming algorithm over a greedy algorithm (such as the one used by fmt) can be seen in the following example: Original paragraph (note that each line begins with 8 spaces): We the people of the United States, in order to form a more perfect union, establish justice, insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessing of liberty to ourselves and our posterity, do ordain and establish the Constitution of the United States of America. After a greedy algorithm with width = 39: We the people of the United States, in order to form a more perfect union, establish justice, insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessing of liberty to ourselves and our posterity, do ordain and establish the Constitution of the United States of America. After "par 39": We the people of the United States, in order to form a more perfect union, establish justice, insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessing of liberty to ourselves and our posterity, do ordain and establish the Constitution of the United States of America. The line breaks chosen by par are clearly more eye-pleasing. par is most useful in conjunction with the text-filtering features of an editor, such as the ! commands of vi. You may wish to add the following lines to your .exrc file: " use Bourne shell for speed: set shell=/bin/sh " " reformat paragraph with no arguments: map ** {!}par^M} " " reformat paragraph with arguments: map *^V {!}par Note that the leading spaces must be removed, and that what is shown as ^M and ^V really need to be ctrl-M and ctrl-V. Also note that the last map command contains two spaces following the ctrl-V, plus one at the end of the line. To reformat a simple paragraph delimited by blank lines in vi, you can put the cursor anywhere in it and type "**" (star star). If you need to supply arguments to par, you can type "* " (star space) instead, then type the arguments. The rest of this section is a series of before-and-after pictures showing some typical uses of par. In all cases, no environment variables are set. Before: /* We the people of the United States, */ /* in order to form a more perfect union, */ /* establish justice, */ /* insure domestic tranquility, */ /* provide for the common defense, */ /* promote the general welfare, */ /* and secure the blessing of liberty */ /* to ourselves and our posterity, */ /* do ordain and establish the Constitution */ /* of the United States of America. */ After "par 59": /* We the people of the United States, in */ /* order to form a more perfect union, establish */ /* justice, insure domestic tranquility, provide */ /* for the common defense, promote the general */ /* welfare, and secure the blessing of liberty */ /* to ourselves and our posterity, do ordain */ /* and establish the Constitution of the United */ /* States of America. */ Or after "par 59f": /* We the people of the United States, */ /* in order to form a more perfect union, */ /* establish justice, insure domestic */ /* tranquility, provide for the common */ /* defense, promote the general welfare, */ /* and secure the blessing of liberty to */ /* ourselves and our posterity, do ordain */ /* and establish the Constitution of the */ /* United States of America. */ Or after "par 59l": /* We the people of the United States, in */ /* order to form a more perfect union, establish */ /* justice, insure domestic tranquility, */ /* provide for the common defense, promote */ /* the general welfare, and secure the */ /* blessing of liberty to ourselves and our */ /* posterity, do ordain and establish the */ /* Constitution of the United States of America. */ Or after "par 59lf": /* We the people of the United States, */ /* in order to form a more perfect union, */ /* establish justice, insure domestic */ /* tranquility, provide for the common */ /* defense, promote the general welfare, */ /* and secure the blessing of liberty */ /* to ourselves and our posterity, do */ /* ordain and establish the Constitution */ /* of the United States of America. */ Or after "par 59lft0": /* We the people of the United States, */ /* in order to form a more perfect union, */ /* establish justice, insure domestic */ /* tranquility, provide for the common */ /* defense, promote the general welfare, */ /* and secure the blessing of liberty */ /* to ourselves and our posterity, do */ /* ordain and establish the Constitution */ /* of the United States of America. */ Or after "par 59j": /* We the people of the United States, in */ /* order to form a more perfect union, establish */ /* justice, insure domestic tranquility, provide */ /* for the common defense, promote the general */ /* welfare, and secure the blessing of liberty */ /* to ourselves and our posterity, do ordain and */ /* establish the Constitution of the United */ /* States of America. */ Or after "par 59jl": /* We the people of the United States, */ /* in order to form a more perfect */ /* union, establish justice, insure domestic */ /* tranquility, provide for the common defense, */ /* promote the general welfare, and secure */ /* the blessing of liberty to ourselves and */ /* our posterity, do ordain and establish the */ /* Constitution of the United States of America. */ Before: Preamble We the people of the United States, to the US in order to form Constitution a more perfect union, establish justice, insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessing of liberty to ourselves and our posterity, do ordain and establish the Constitution of the United States of America. After "par 52h3": Preamble We the people of the United to the US States, in order to form a Constitution more perfect union, establish justice, insure domestic tranquility, provide for the common defense, promote the general welfare, and secure the blessing of liberty to ourselves and our posterity, do ordain and establish the Constitution of the United States of America. Before: 1 We the people of the United States, 2 in order to form a more perfect union, 3 establish justice, 4 insure domestic tranquility, 5 provide for the common defense, 6 promote the general welfare, 7 and secure the blessing of liberty 8 to ourselves and our posterity, 9 do ordain and establish the Constitution 10 of the United States of America. After "par 59p12l": 1 We the people of the United States, in order to 2 form a more perfect union, establish justice, 3 insure domestic tranquility, provide for the 4 common defense, promote the general welfare, 5 and secure the blessing of liberty to ourselves 6 and our posterity, do ordain and establish the 7 Constitution of the United States of America. Before: > > We the people > > of the United States, > > in order to form a more perfect union, > > establish justice, > > ensure domestic tranquility, > > provide for the common defense, > > Promote the general welfare, > and secure the blessing of liberty > to ourselves and our posterity, > do ordain and establish > the Constitution of the United States of America. After "par 52": > > We the people of the United States, in > > order to form a more perfect union, > > establish justice, ensure domestic > > tranquility, provide for the common > > defense, > > Promote the general welfare, and secure > the blessing of liberty to ourselves and > our posterity, do ordain and establish > the Constitution of the United States of > America. Before: > We the people > of the United States, > in order to form a more perfect union, > establish justice, > ensure domestic tranquility, > provide for the common defense, > Promote the general welfare, > and secure the blessing of liberty > to ourselves and our posterity, > do ordain and establish > the Constitution of the United States of America. After "par 52d": > We the people of the United States, > in order to form a more perfect union, > establish justice, ensure domestic > tranquility, provide for the common > defense, > Promote the general welfare, and secure > the blessing of liberty to ourselves and > our posterity, do ordain and establish > the Constitution of the United States of > America. Before: # 1. We the people of the United States. # 2. In order to form a more perfect union. # 3. Establish justice, ensure domestic # tranquility. # 4. Provide for the common defense # 5. Promote the general welfare. # 6. And secure the blessing of liberty # to ourselves and our posterity. # 7. Do ordain and establish the Constitution. # 8. Of the United States of America. After "par 37p13dh": # 1. We the people of the # United States. # 2. In order to form a more # perfect union. # 3. Establish justice, # ensure domestic # tranquility. # 4. Provide for the common # defense # 5. Promote the general # welfare. # 6. And secure the blessing # of liberty to ourselves # and our posterity. # 7. Do ordain and establish # the Constitution. # 8. Of the United States of # America. Before: /*****************************************/ /* We the people of the United States, */ /* in order to form a more perfect union, */ /* establish justice, insure domestic */ /* tranquility, */ /* */ /* */ /* [ provide for the common defense, ] */ /* [ promote the general welfare, ] */ /* [ and secure the blessing of liberty ] */ /* [ to ourselves and our posterity, ] */ /* [ ] */ /* */ /* do ordain and establish the Constitution */ /* of the United States of America. */ /******************************************/ After "par 42r": /********************************/ /* We the people of the */ /* United States, in order to */ /* form a more perfect union, */ /* establish justice, insure */ /* domestic tranquility, */ /* */ /* */ /* [ provide for the common ] */ /* [ defense, promote the ] */ /* [ general welfare, and ] */ /* [ secure the blessing of ] */ /* [ liberty to ourselves ] */ /* [ and our posterity, ] */ /* [ ] */ /* */ /* do ordain and establish the */ /* Constitution of the United */ /* States of America. */ /********************************/ Or after "par 42re": /********************************/ /* We the people of the */ /* United States, in order to */ /* form a more perfect union, */ /* establish justice, insure */ /* domestic tranquility, */ /* */ /* [ provide for the common ] */ /* [ defense, promote the ] */ /* [ general welfare, and ] */ /* [ secure the blessing of ] */ /* [ liberty to ourselves ] */ /* [ and our posterity, ] */ /* */ /* do ordain and establish the */ /* Constitution of the United */ /* States of America. */ /********************************/ Before: Joe Public writes: > Jane Doe writes: > > > > > > I can't find the source for uncompress. > Oh no, not again!!! > > > Isn't there a FAQ for this? > > That wasn't very helpful, Joe. Jane, just make a link from uncompress to compress. After "par 40q": Joe Public writes: > Jane Doe writes: > > > > I can't find the source for > > uncompress. > > Oh no, not again!!! > > > Isn't there a FAQ for this? > That wasn't very helpful, Joe. Jane, just make a link from uncompress to compress. Or after "par 40qe": Joe Public writes: > Jane Doe writes: > > > I can't find the source for > > uncompress. > > Oh no, not again!!! > > Isn't there a FAQ for this? That wasn't very helpful, Joe. Jane, just make a link from uncompress to compress. Or after "par 40qi": Joe Public writes: > Jane Doe writes: > > > > > > I can't find the source for > > uncompress. > Oh no, not again!!! > > > Isn't there a FAQ for this? > > That wasn't very helpful, Joe. Jane, just make a link from uncompress to compress. Or after "par 40qie": Joe Public writes: > Jane Doe writes: > > I can't find the source for > > uncompress. > Oh no, not again!!! > > Isn't there a FAQ for this? That wasn't very helpful, Joe. Jane, just make a link from uncompress to compress. Before: I sure hope there's still room in Dr. Jones' section of archaeology. I've heard he's the bestest. [sic] After "par 50g": I sure hope there's still room in Dr. Jones' section of archaeology. I've heard he's the bestest. [sic] Or after "par 50gc": I sure hope there's still room in Dr. Jones' section of archaeology. I've heard he's the bestest. [sic] Before: John writes: : Mary writes: : + Anastasia writes: : + > Hi all! : + Hi Ana! : Hi Ana & Mary! Please unsubscribe me from alt.hello. After "par Q+:+ q": John writes: : Mary writes: : : + Anastasia writes: : + : + > Hi all! : + : + Hi Ana! : : Hi Ana & Mary! Please unsubscribe me from alt.hello. Before: amc> The b option was added primarily to deal with amc> this new style of quotation amc> which became popular after Par 1.41 was released. amc> amc> Par still pays attention to body characters. amc> Par should not mistake "Par" for part of the prefix. amc> Par should not mistake "." for a suffix. After "par B=._A_a 50bg": amc> The b option was added primarily to amc> deal with this new style of quotation amc> which became popular after Par 1.41 amc> was released. amc> amc> Par still pays attention to body amc> characters. Par should not mistake amc> "Par" for part of the prefix. Par amc> should not mistake "." for a suffix. SEE ALSO par.doc LIMITATIONS The guess feature guesses wrong in cases like the following: I calc'd the approx. Fermi level to 3 sig. digits. With guess = 1, par will incorrectly assume that "approx." ends a sen‐ tence. If the input were: I calc'd the approx. Fermi level to 3 sig. digits. then par would refuse to put a line break between "approx." and "Fermi" in the output, mainly to avoid creating the first situation (in case the paragraph were to be fed back through par again). This non-breaking space policy does come in handy for cases like "Mr. Johnson" and "Jan. 1", though. The guess feature only goes one way. par can preserve wide sentence breaks in a paragraph, or remove them, but it can't insert them if they aren't already in the input. If you use tabs, you may not like the way par handles (or doesn't handle) them. It expands them into spaces. I didn't let par output tabs because tabs don't make sense. Not everyone's terminal has the same tab set‐ tings, so text files containing tabs are sometimes mangled. In fact, almost every text file containing tabs gets mangled when something is inserted at the beginning of each line (when quoting e-mail or commenting out a section of a shell script, for example), making them a pain to edit. In my opinion, the world would be a nicer place if everyone stopped using tabs, so I'm doing my part by not letting par output them. (Thanks to Eric Stuebe for showing me the light about tabs.) There is currently no way for the length of the output prefix to differ from the length of the input prefix. Ditto for the suffix. I may con‐ sider adding this capability in a future release, but right now I'm not sure how I'd want it to work. APOLOGIES Par began in July 1993 as a small program designed to do one narrow task: reformat a single paragraph that might have a border on either side. It was pretty clean back then. Over the next three months, it very rapidly expanded to handle multiple paragraphs, offer more options, and take bet‐ ter guesses, at the cost of becoming extremely complex, and very unclean. It is nowhere near the optimal design for the larger task it now tries to address. Its only redeeming features are that it is extremely useful (I find it indispensable), extremely portable, and very stable (between the release of version 1.41 on 1993-Oct-31 and the release of version 1.52 on 2001-Apr-29, no incorrect behavior was reported). Back in 1993 I had very little experience at writing documentation for users, so the documentation for Par became rather nightmarish. There is no separation between how-it-works (which is painfully complex) and how- to-use-it (which is fairly simple, if you can ever figure it out). Someday I ought to reexamine the problem, and redesign a new, clean solu‐ tion from scratch. I don't know when I might get enough free time to start on such a project. Text files may be obsolete by then. BUGS If I knew of any bugs, I wouldn't release the package. Of course, there may be bugs that I haven't yet discovered. If you find any bugs (in the program or in the documentation), or if you have any suggestions, please send e-mail to<EMAIL_ADDRESS>When reporting a bug, please include the exact input and command line options used, and the version number of par, so that I can reproduce it. The latest release of Par is available on the Web at: http://www.cs.berkeley.edu/~amc/Par/ These addresses will change. I'll try to leave forward pointers. Par 1.52 2001-Apr-29 par(1)


| Traveler | Institution | Anton Francesch, Judit | Massachusetts Institute of TechnologyArmengol Urpi, Alexandre | Massachusetts Institute of TechnologyAsad, Muhammad | City University LondonBambach, Sven | Indiana UniversityBehpour, Sima | University of Illinois at ChicagoBoixareau Fiol, Margarita | Massachusetts Institute of TechnologyCarne Herrera, Marc | Universitat Politecnica de CatalunyaDe Smedt, Quentin | Telecom LilleGomez Gonzalvo, Alberto | Technical University of Catalonia/MITGupta, Karthik | Indian Institute of Technology-MandiKhan, Aisha Urooj | University of Central FloridaLee, Stefan | Indiana UniversityOhn-Bar, Eshed | University of California-San DiegoRangesh, Akshay | UC-San DiegoSalvador, Amaia | Universitat Politecnica de CatalunyaTkach, Anastasia | Swiss Federal Institute of Technology
|---|
The School of Mechanical and Electrical and Computer Engineering at Purdue University is happy to support up to 22 travel awards of $600 each for students to travel to the HANDS workshop at the CVPR 2016*. These grants will be on a cost reimbursement basis so submission of receipts will be required. Participants may contact Michelle Sarault at<EMAIL_ADDRESS>for instructions for completing the requirements for the travel award. Please obtain a short letter from your academic advisor and send it along with a short note of your interest in the HANDS workshop to Michelle Sarault. The awards will be made on a first come basis until the maximum support possible is reached. These awards are made available through funding from the National Science Foundation CMMI division through the award: Affordable Design through Realistic Interactions for Virtual Explorations award to Professor Karthik Ramani at Purdue University.
Other conditions: Everyone that receives a grant will be required to complete a Payee Certification form. They will need to complete Section A and B and sign in Section C. They will need to return the form along with their receipts for the amount of the travel grant. Additionally, if they are not a US Citizen or Permanent Resident Michelle will set them up with an account and students will have to complete some tax information.
* Grants per applicant may increase if the successful applications are less than 22.
Karthik Ramani
Donald W. Feddersen Professor of Mechanical Engineering
Professor of Electrical and Computer Engineering (by courtesy)
C Design Labs: https://engineering.purdue.edu/cdesign/wp/
Toy Design: https://engineering.purdue.edu/toydesign/wp/
Product Design: https://engineering.purdue.edu/productdesign/wp/
Ziro from ZeroUI: https://www.ziro.io


OSU USLI
Menu
About Us
Deliverables
Documentation
Sponsors
#USLI
Google Drive
Trello
Github
USLI Team Sponsors
A big thanks to our generous sponsors!
The American Institute of Aeronautics and Astronautics
Competition Sponsor
AIAA
OSU College of Engineering
Competition Sponsor
College of Engineering
Oregon NASA Space Grant Consortium
Competition Sponsor
Oregon Space Grant Consortium
Material and Rocket Sponsors
Fruity Chutes!
Parachutes
Jolly Logic
Paracute release
Innovative Composite Engineering
Carbon Fiber
Robot Shop
Robotics parts


Youtube video with thumbnail and title from API
Youtube video with custom thumbnail and title
Vimeo video with thumbnail and title from API
Vimeo video with custom thumbnail and title
Iframe with custom theme and title
Google maps iframe with custom thumbnail and title that gets executed when in view


But he could not tell the trouth! So the truce, the old holmsted here. O, dear me, that I indicate out to be their gosson and whereas to brake the news to morhor. It would be thinking in your tracks, babe! If you were undone in every pub of all Fenns! Deaf to the winner! You’re a nice production.
And then the moon behinding out of the sea, or what static babel is this, my sorellies. You'll hear him twixt his sedimental cupslips when he steals one and turn over. Her boy fiend or theirs, if they weren’t having anysin on their taws. This is the Willingdone hanking the half of the noise and somewho might amove allmurk. Red Rowleys popped out of Denis Florence MacCarthy’s combies. Someone he was, whuebra they were, her uyes as his match, healtheous as is possible.


{empty name="uid"} {include file="../application/common/view/IndexHeader.html" /} {else /} {include file="../application/common/view/Header.html" /} {/empty}


Right Here, Right Now.
{% csrf_token %} {{ form }}
Don't Jump Through Hoops.
Agents will....
Sell With Revre
Talk to an Agent


| Modifier and Type | Class and Description |
|---|---|
class |
ApplicationConfiguration
Basic implementation of an application configuration.
|
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultExceptionMapper
Default implementation of
ExceptionMapper . |
class |
DefaultRoutes
Default implementation of route info extractor.
|
class |
DefaultStaticContentHandler
Handles default content if the request corresponds to static content.
|
| Modifier and Type | Class and Description |
|---|---|
class |
XStreamXMLDeserializer
XStream based Xml Deserializer
|
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultJsonDeserializers |
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultFormatResolver
Default implementation for FormatResolver.
|
| Modifier and Type | Class and Description |
|---|---|
class |
IogiParametersProvider |
class |
VRaptorDependencyProvider
an adapter for IOGI's dependency provider based on VRaptor's container
|
class |
VRaptorInstantiator |
class |
VRaptorParameterNamesProvider
An adapter for iogi's parameterNamesProvider
|
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultRestfulie
Default implementation for
Restfulie |
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultRestDefaults
Default implementation for REST defaults.
|
class |
DefaultRestHeadersHandler |
| Modifier and Type | Class and Description |
|---|---|
class |
RestfulSerialization
Custom serialization process provides a way to add links to your resource representations.
|
class |
RestfulSerializationJSON
Custom serialization process provides a way to add links to your resource representations.
|
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultRepresentationResult
Default implementation for RepresentationResult that uses request Accept format to
decide which representation will be used
|
class |
DefaultXMLConfiguration
Basic xml configuration for xml serialization.
|
class |
HTMLSerialization
delegates the serialization for the default view
|
class |
I18nMessageSerialization
Basic i18n messsage json serialization alias.
|
class |
NullProxyInitializer
ProxyInitializer that does nothing.
|
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultJsonSerializers |
class |
GsonJSONSerialization
Gson implementation for JSONSerialization
|
class |
GsonSerializee |
class |
VRaptorGsonBuilder |
| Modifier and Type | Class and Description |
|---|---|
class |
CalendarDeserializer |
class |
CalendarSerializer |
class |
MessageSerializer |
| Modifier and Type | Class and Description |
|---|---|
class |
CalendarISO8601Deserializer |
class |
CalendarISO8601Serializer |
class |
DateISO8601Deserializer |
class |
DateISO8601Serializer |
| Modifier and Type | Class and Description |
|---|---|
class |
XStreamBuilderImpl
Implementation of default XStream configuration
|
class |
XStreamConverters
Component used to scan all XStream converters
|
static class |
XStreamConverters.NullConverter
for DI purposes
|
class |
XStreamJSONPSerialization
Default implementation for JSONPSerialization that decorates default jsonSerialization output
adding the callback padding
|
class |
XStreamJSONSerialization
XStream implementation for JSONSerialization
|
class |
XStreamXMLSerialization
XStream implementation for XmlSerialization
|
| Modifier and Type | Class and Description |
|---|---|
class |
ISO8601Util
Helper class for handling ISO8601 strings of the following format:
"1982-06-10T05:00:00.000-03:00".
|
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultExtJson
Implementation for
ExtJSJson . |
| Modifier and Type | Class and Description |
|---|---|
class |
MockHttpResult
A mocked Result for testing the http body, content type and character encoding.
|
class |
MockHttpServletResponse
A simple mock for HttpServletResponse.
|
class |
MockResult
A mocked Result for testing your controllers.
|
class |
MockSerializationResult
A mocked Result for testing your serialized objects returns.
|
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultBeanValidator
Implements the
BeanValidator using Bean Validation (JSR303). |
class |
MessageConverter
Converter for normalizing
Message serialization |
class |
MessageInterpolatorFactory
Factory for JSR303 MessageInterpolator
|
class |
ReplicatorOutjector
Outjector implementation that replicates logic parameters to next logic
|
class |
ValidatorCreator
Bring up Bean Validation factory.
|
class |
ValidatorFactoryCreator
Factory for JSR303 ValidatorFactory
|
| Modifier and Type | Class and Description |
|---|---|
class |
DefaultHttpResult
Implementation that delegates to HttpServletResponse
|
class |
DefaultRefererResult |
class |
DefaultStatus
Allows header related results.
|
class |
DefaultValidationViewsFactory
Default implementation for ValidationViewsFactory
If you want to extend this behavior use:
|
class |
SessionFlashScope
FlashScope that uses the HttpSession to hold the data
|
Copyright © 2013 Caelum. All Rights Reserved.


:: com :: sun :: star :: frame ::
|
| unpublished |
service ToolbarController |
|
|
- Usage Restrictions
- not published
- Description
- is an abstract service for a component which offers a more complex user
interface to users within a toolbar.
A generic toolbar function is represented as a button which has a state
(enabled,disabled and selected, not selected). A toolbar controller can
be added to a toolbar and provide information or functions within a more
sophisticated user interface. A typical example for toolbar controller
is the font chooser within the toolbar. It provides all available fonts in
a dropdown box and shows the current chosen font.
- Since
- OOo 2.0
- See also
- XDispatchProvider
|
| Exported Interfaces - Summary |
| XStatusListener |
with this interface a component can receive events if a feature has
changed.
(details)
|
| ::com::sun::star::lang::XInitialization |
used to initialize a component with required arguments.
A toolbar controller needs at least three additional arguments
provided as ::com::sun::star::beans::PropertyValue:
(details)
|
| ::com::sun::star::util::XUpdatable |
used to notify an implementation that it needs to add its listener or remove
and add them again.
(details)
|
| XToolbarController |
used to notify changed features and requests for additional user interface
items.
(details)
|
| XSubToolbarController |
used to notify and retrieve information that are specific for sub-toolbar
controllers.
(details)
|
| Exported Interfaces - Details |
XStatusListener
- Description
- with this interface a component can receive events if a feature has
changed.
The toolbar controller implementation should register itself as a
listener when its XUpdatable
interface has been called.
|
|
::com::sun::star::lang::XInitialization
- Description
- used to initialize a component with required arguments.
A toolbar controller needs at least three additional arguments
provided as ::com::sun::star::beans::PropertyValue:
- Frame
a XFrame
instance to which the toolbar controller belongs.
- CommandURL
a string which specifies the command a
toolbar controller is bound.
- ServiceManager
a
::com::sun::star::lang::XMultiServiceFactory
instance which can be used to create additional UNO services.
|
|
::com::sun::star::util::XUpdatable
- Description
- used to notify an implementation that it needs to add its listener or remove
and add them again.
A toolbar controller instance is ready for use after this call has been made
the first time. The toolbar implementation guarentees that the controller's
item window has been added to the toolbar and its reference is held by it.
|
|
XToolbarController
- Description
- used to notify changed features and requests for additional user interface
items.
Mostly used by a toolbar implementation to forward information to and request
services from a toolbar controller component. This interface must be useable
after com::sun::star::lang::XInitialitation::initialize
has been called. The behavior of the interface is undefined if the controller
component hasn't been initialized.
|
|
XSubToolbarController
- Usage Restrictions
- optional
- Description
- used to notify and retrieve information that are specific for sub-toolbar
controllers.
Used by implementations that want to provide the toolbar button/sub-
toolbar function feature. A controller supporting this interface exchanges
the function of its own toolbar button, that opened the sub-toolbar, with
the one that has been selected on the sub-toolbar.
|
|
Top of Page
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


Class: Puma::StateFile
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | lib/puma/state_file.rb |
Overview
Launcher
uses StateFile
to write a yaml file for use with ControlCLI
.
In previous versions of ::Puma
, YAML was used to read/write the state file. Since Puma is similar to Bundler/RubyGems in that it may load before one’s app does, minimizing the dependencies that may be shared with the app is desired.
At present, it only works with numeric and string values. It is still a valid yaml file, and the CI tests parse it with Psych.
Constant Summary
-
ALLOWED_FIELDS =
# File 'lib/puma/state_file.rb', line 16%w!control_url control_auth_token pid running_from!
-
FIELDS =
# File 'lib/puma/state_file.rb', line 19Deprecated.
6.0.0
ALLOWED_FIELDS
Class Method Summary
- .new ⇒ StateFile constructor
Instance Method Summary
Constructor Details
.new ⇒ StateFile
# File 'lib/puma/state_file.rb', line 21
def initialize @options = {} end
Instance Method Details
#load(path)
[ GitHub ]# File 'lib/puma/state_file.rb', line 45
def load(path) File.read(path).lines.each do |line| next if line.start_with? '#' k,v = line.split ':', 2 next unless v && ALLOWED_FIELDS.include?(k) v = v.strip @options[k] = case v when '' then nil when /\A\d+\z/ then v.to_i when /\A\d\.\d\z/ then v.to_f else v.gsub(/\A"|"\z/, '') end end end
#save(path, permission = nil)
[ GitHub ]# File 'lib/puma/state_file.rb', line 25
def save(path, = nil) contents = "---\n".dup @options.each do |k,v| next unless ALLOWED_FIELDS.include? k case v when Numeric contents << "#{k}: #{v}\n" when String next if v.strip.empty? contents << (k == 'running_from' || v.to_s.include?(' ') ? "#{k}: \"#{v}\"\n" : "#{k}: #{v}\n") end end if File.write path, contents, mode: 'wb:UTF-8' else File.write path, contents, mode: 'wb:UTF-8', perm: end end


Try and reach the element(s) below using just your keyboard. If you can't, use your mouse.
No connection between label and input
Without an association between a label ("label for='someInput'
) and an input field ("id='someInput'
), there is no way for
a screenreader to know which label goes with which input and it will simply read back, "edit text" without any other context.
Input field is not actually required
This input field has its label
/input
association correctly set up, but it doesn't actually tell the screenreader user that the field is required in order
to proceed. It, instead, relies solely on an asterisk to convey with information, which is not something a blind person is going to be able to see.


Reinforcement Learning: Markov Decision Process
04 Dec 2017Introduction
In a previous post, I gave an introduction to reinforcement learning. In the this post I will try to lay the foundation of the reinforcement learning theory. We will look into how the problem can be framed mathematically.
Markov decision process
In order to reason about reinforcement learning problem we need to put it into some mathematics. The Markov decision process (MDP) framework is a classical formalization of sequential decision making, which we can use to achieve this. The MDP relies on the Markov property, which states that:
A Markov chain is a (possibly stochastic) discrete time process determining the transition between different states \( s \). In order for it to be a Markov chain, it needs to satisfy the Markov property. Extending Markov chains with decisions and rewards gives the MDP. An illustration of the MDP is given in the figure below.
The different components in a MDP are:
- States: \( s \in \mathcal{S} \)
- Observations: \( y \in \mathcal{Y} \)
- Actions: \( a \in \mathcal{A} \)
- Reward: \( r \in \mathcal{R} \)
- State transition: \( p(s’,r \mid s,a): \mathcal{S} \times \mathcal{R} \times \mathcal{S} \times \mathcal{A} \to [0,1] \)
Using this notation we can express a process with the Markov property as
\begin{equation} \mathbb{P} (s_{t+1} \mid s_t, a_t, s_{t-1}, a_{t-1}, …) = \mathbb{P} (s_{t+1} \mid s_t, a_t), \end{equation}
meaning our state transition \( p(s’,r \mid s,a) \) only need to depend on the current state. In the case of a deterministic Markov process we can define the state transition function \( f(s,a): \mathcal{S} \times \mathcal{A} \to \mathcal{S} \times \mathcal{R} \) as
\begin{equation} (s_{t+1},r_{t+1}) = f(s_t,a_t,s_{t-1},a_{t-1},…) = f(s_t,a_t). \end{equation}
The mapping between states and observations is \( y_t = s_t \), in the case we do have perfect state observation of the process. If the observation is noisy or incomplete, we have \( \mathbb{P} (y_t \mid s_t) \) in the stochastic case and \( y_t = g(s_t) \) in the deterministic case (where \( g(s): \mathcal{S} \to \mathcal{Y} \) is the observation function). Furthermore, the process can be said to be stationary if the probability \( \mathbb{P} \) (or the functions \( f \) and \( g \) in the deterministic case) does not change with time.
State
According to the Markov property, the Markov state is a sufficient statistics of the future. A Markov state can always be found, since one can always include the complete history of the past in the current state. However, it is preferable to keep the state representation as compact as possible without losing the Markov property. Therefore, it is the up designer of the algorithm to choose appropriate information of the past to include in the state representation.
An example of an imperfect state representation (which is non-markovian) is to only include the position and not the velocity of a flying aircraft. In this case there is no way to tell the difference between an aircraft that is falling straight down or cruising at a safe speed from its state alone. In this case the correct state representation would be both position and velocity. This fact is mathematically justified in that both initial position and velocity is needed to integrate the governing equations of motion (Newton’s second law) forward in time.
Agent
The agent in reinforcement learning is an entity that is learning and making decision based on previous experience. It can be anything from a Go player to a physical robot playing football. The agent is not told how to achieve a task rather it is given an objective in the form of a reward signal. By using the information in the reward signal, it is up to the agent to find a policy that enables it to make the correct action given an observation for reaching the long-term objective. The agent may not have perfect perception of the state. Observations might be noisy or provide only incomplete information.
Environment
The agent is situated in an environment with some characteristics. Some examples of environments are the rules of Go, Atari 2600 games and real world physics. In the MDP, the state transitions are given by the state transition function \( p(s’,r \mid s,a) \). Usually, the characteristics of an environment are not known and can be both deterministic or stochastic. In stochastic environments, taking the same action in the same state twice may result in different next states and/or rewards. Furthermore, if the environment is non-stationary, the probabilities of making state transitions or receiving specific rewards may also change over time.
The reward
One of the main assumptions in reinforcement learning is the reward hypothesis, which states:
It argued that a single scalar must be enough to specify the reward signal since the aim of a agent is to provide appropriate actions. To make actions you need to weight up different possible outcomes in the end anyway. This assumption is probably the most disputable assumption in all of reinforcement learning.
The reward signal is external to the agent (and should be beyond its ability to change arbitrarily) since it part of the task definition. Therefore, it is up to the designer of the algorithm to express the the reward signal mathematically. If we want a reinforcement learning agent to do something for us, we must proved rewards to it in such a way that by maximizing them, the agent will also achieve our goal. In other words, if the reward is designed to maximize some artificial subgoal, then the agent might find a way to solve the subgoal without solving the actual goal.
The MDP might involve delayed rewards and the need to trade-off immediate and delayed rewards. For this reason it is not sufficient to only account for the immediate when learning optimal operating strategies. The most commonly used objective (or target) function to maximise is the infinite-horizon discounted reward. This objective function takes long-run reward into account but future rewards are geometrically discounted using a discounting factor \( \gamma \in [0,1] \). The cumulative discounted reward is calculated as:
\begin{equation} G_t = r_{t+1} + \gamma r_{t+2} + \gamma^2 r_{t+3} + … + \gamma^{T-1} r_{t+T} = \sum_{k=1}^{T} \gamma^{k-1} r_{t+k}, \end{equation}
where the probability of receiving reward \( r_{t+1} \) is given by
\begin{equation} R(r_{t+1} \mid s_t,a_t) = \sum_{s_{t+1} \in \mathcal{S}} p(s_{t+1},r_{t+1} \mid s_t,a_t). \end{equation}
The task to be performed can either be divided into distinct episodes (for episodical tasks) for which \( T \in \mathbb{N} \) or be continuing for which \( T \to \infty \). Setting \( \gamma = 0 \) and \( \gamma \) = 1 result in a myopic and far-sighted estimate respectively. The use of a discounting factor \( \gamma \) can be justified in several ways:
- future reward is more uncertain and should therefore be discounted;
- future reward is less valuable (see for example Time value of money);
- as a mathematical trick to bound the infinite sum.
In order to assure that the sum is bounded for continuing tasks, the reward sequence \( { r_k } \) must be bounded as well as \( \gamma \neq 1 \). We can see episodical tasks to be a special case of continuing tasks by considering an “absorbing” terminal state which maps back to itself with probability 1 and repeatedly gives zero reward. Therefore, \( G_T = 0 \) for episodical tasks.
Experience tuple
By putting the concept of state, action and reward together we can represent a sample of experience as
\begin{equation} \langle s, a, r, s’ \rangle, \end{equation}
where \( s’ \) is the next state after taking action \( a \) in state \( s \) and receiving reward \( r \). For an episode of length \( T \) we will accumulate a corresponding number of such experience tuples.
References
- David Silver’s course on reinforcement learning
- Leslie Pack, Kaelbing et al., Reinforcement Learning: A Survey
- Richard S. Sutton and Andrew G. Barto, Reinforcement Learning: An Introduction
- Wikipedia, Markov decision process


How to Play:
Scissors cut Paper, Paper covers Rock, Rock crushes Scissors. Fill all the grey boxes with Rocks to win.


This ancient city, home of Archimedes, is on the east coast. The large natural harbour is a busy commercial port. This city is well worth a visit, helped by the fact that yachts get 5 days berthing for free (if they can find space).
Yachts must call the Port Authority on VHF Ch.16 on approach or fines may apply.
Position 37° 3.5' N, 15° 17.2' E.
Good all round shelter, although more exposed to the SE.
The harbour here has been refurbished and provides good service.
Yachts berth (for free), stern-to, at quay 11C (depth 3m) the Grand Harbour on the northern side of the town. There can be a big swell in the harbour, so care needs to be taken over where to berth.
There is now a small port on the southern side of the peninsula, Marina Yachting, in the area by the canal which separates Ortygia from the mainland.There is plenty of room and good anchorages in Grand Harbour.
There is a dinghy landing in the corner of the new marina.
Last updated June 2016.


This model presents a person attributes classification algorithm for a traffic analysis scenario.
| Attribute | Value |
|---|---|
| is male | true |
| has hat | false |
| has longsleeves | true |
| has longpants | true |
| has longhair | false |
| has coat_jacket | false |
| Metric | Value |
|---|---|
| Pedestrian pose | Standing person |
| Occlusion coverage | <20% |
| Min object width | 80 pixels |
| Supported attributes | gender, has hat, has longsleeves, has longpants, has longhair, has coat_jacket |
| GFlops | 0.219 |
| MParams | 1.102 |
| Source framework | Caffe* |
| Attribute | Precision | Recall | F1 | Accuracy |
|---|---|---|---|---|
| Average | 0.90 | 0.86 | 0.88 | 0.90 |
is_male |
0.89 | 0.87 | 0.88 | 0.86 |
has_hat |
0.67 | 0.35 | 0.46 | 0.97 |
has_longsleeves |
0.92 | 0.93 | 0.96 | 0.94 |
has_longpants |
0.97 | 0.96 | 0.96 | 0.94 |
has_longhair |
0.80 | 0.73 | 0.76 | 0.91 |
has_coat_jacket |
0.73 | 0.52 | 0.61 | 0.84 |
Link to performance table
name: "input" , shape: [1x3x80x160] - An input image in following format [1xCxHxW], where
The expected color order is BGR.
is_male
, has_hat
, has_longsleeves
, has_longpants
, has_longhair
, has_coat_jacket
]. Value > 0.5 means that an attribute is present.[*] Other names and brands may be claimed as the property of others.


@(model: MatchesPage, isLive: String = "false")(implicit request: RequestHeader)
@model.days.map{ day =>
@if(isLive != "live") {
@day.date.toString("EEEE d MMMM yyyy")
}
@day.competitions.zipWithRowInfo.map{ case (comp, row) =>
-
@* sort matches by start time, then alphabet *@
@comp.matches.map{ theMatch =>
@renderMatch(theMatch)
}
@* Shows the live blog (if there is one) after the first competition *@
@if(row.isFirst){
@model.blog.map{ blog =>
@fragments.trails.thumbnail(blog, row.rowNum, element = "div")
}
}
}
}
@if(!model.days) {
There are no matches being played today. Why not check out upcoming fixtures or previous results?
}


Energy Consumption Prediction v1.0
Dashboard
Visualization
Micro
Macro
Tables
Forms
Dashboard
School Dataset
Input the Values
OR
Attach the file


Using CSS to design your site is oftentimes full of "guess-and-check" work.
Fortunately, the developer tools allow us to make changes to an element's CSS right in the browser without having to make any changes to the code itself.
This way, we can test our changes and IMMEDIATELY see what they would look like.
Otherwise, you'd be making changes to the code, switching back to the browser, and refreshing the page EACH TIME you wanted to make a change.
In part 2 of this project, we've hidden an HTML image element from the viewable area of the screen.
In order to move on, figure out how to temporarily change the CSS of that item so that it displays on the screen.


{{languages[(languageIndex + 1)%2].title}}
{{languages[(languageIndex + 1)%2].title}}
RecyclerView
从未如此简单
Change numerous for brief
RecyclerView has never been so easy
RecyclerView
BRVAH
HAPPY
1ST BIRTHDAY!
V1.0
9dd98b2
V1.0
CymChad tagged this on 10 Apr 2016.7.11 commits to master since this tag create README.md
Downloads
Source code (zip)
Source code (tar.gz)
{{item.text}}
{{item.number}}
{{item.name}}