001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.commons.text.similarity; 018 019/** 020 * A similarity algorithm indicating the length of the longest common subsequence between two strings. 021 * 022 *
 023 * The Longest common subsequence algorithm returns the length of the longest subsequence that two strings have in 024 * common. Two strings that are entirely different, return a value of 0, and two strings that return a value 025 * of the commonly shared length implies that the strings are completely the same in value and position. 026 * Note. Generally this algorithm is fairly inefficient, as for length m, n of the input 027 * {@code CharSequence}'s {@code left} and {@code right} respectively, the runtime of the 028 * algorithm is O(m*n). 029 *
 030 * 031 *
 032 * As of version 1.10, a more space-efficient of the algorithm is implemented. The new algorithm has linear space 033 * complexity instead of quadratic. However, time complexity is still quadratic in the size of input strings. 034 *
 035 * 036 *
 037 * The implementation is based on Hirschberg's Longest Commons Substring algorithm (cited below). 038 *
 039 * 040 *
For further reading see:
 041 *
 042 *
 043 * Lothaire, M. Applied combinatorics on words. New York: Cambridge U Press, 2005. 12-13 044 *
 045 *
 046 * D. S. Hirschberg, "A linear space algorithm for computing maximal common subsequences," CACM, 1975, pp. 341--343. 047 *
 048 *
 049 * 050 * @since 1.0 051 */ 052public class LongestCommonSubsequence implements SimilarityScore<Integer> { 053 054 /** 055 * An implementation of "ALG B" from Hirschberg's CACM '71 paper. 056 * Assuming the first input sequence is of size m and the second input sequence is of size 057 * n, this method returns the last row of the dynamic programming (DP) table when calculating 058 * the LCS of the two sequences in O(m*n) time and O(n) space. 059 * The last element of the returned array, is the size of the LCS of the two input sequences. 060 * 061 * @param left first input sequence. 062 * @param right second input sequence. 063 * @return last row of the dynamic-programming (DP) table for calculating the LCS of left and right 064 * @since 1.10.0 065 */ 066 private static int[] algorithmB(final CharSequence left, final CharSequence right) { 067 final int m = left.length(); 068 final int n = right.length(); 069 070 // Creating an array for storing two rows of DP table 071 final int[][] dpRows = new int[2][1 + n]; 072 073 for (int i = 1; i <= m; i++) { 074 // K(0, j) <- K(1, j) [j = 0...n], as per the paper: 075 // Since we have references in Java, we can swap references instead of literal copying. 076 // We could also use a "binary index" using modulus operator, but directly swapping the 077 // two rows helps readability and keeps the code consistent with the algorithm description 078 // in the paper. 079 final int[] temp = dpRows[0]; 080 dpRows[0] = dpRows[1]; 081 dpRows[1] = temp; 082 083 for (int j = 1; j <= n; j++) { 084 if (left.charAt(i - 1) == right.charAt(j - 1)) { 085 dpRows[1][j] = dpRows[0][j - 1] + 1; 086 } else { 087 dpRows[1][j] = Math.max(dpRows[1][j - 1], dpRows[0][j]); 088 } 089 } 090 } 091 092 // LL(j) <- K(1, j) [j=0...n], as per the paper: 093 // We don't need literal copying of the array, we can just return the reference 094 return dpRows[1]; 095 } 096 097 /** 098 * An implementation of "ALG C" from Hirschberg's CACM '71 paper. 099 * Assuming the first input sequence is of size m and the second input sequence is of size 100 * n, this method returns the Longest Common Subsequence (LCS) of the two sequences in 101 * O(m*n) time and O(m+n) space. 102 * 103 * @param left first input sequence. 104 * @param right second input sequence. 105 * @return the LCS of left and right 106 * @since 1.10.0 107 */ 108 private static String algorithmC(final CharSequence left, final CharSequence right) { 109 final int m = left.length(); 110 final int n = right.length(); 111 112 final StringBuilder out = new StringBuilder(); 113 114 if (m == 1) { // Handle trivial cases, as per the paper 115 final char leftCh = left.charAt(0); 116 for (int j = 0; j < n; j++) { 117 if (leftCh == right.charAt(j)) { 118 out.append(leftCh); 119 break; 120 } 121 } 122 } else if (n > 0 && m > 1) { 123 final int mid = m / 2; // Find the middle point 124 125 final CharSequence leftFirstPart = left.subSequence(0, mid); 126 final CharSequence leftSecondPart = left.subSequence(mid, m); 127 128 // Step 3 of the algorithm: two calls to Algorithm B 129 final int[] l1 = algorithmB(leftFirstPart, right); 130 final int[] l2 = algorithmB(reverse(leftSecondPart), reverse(right)); 131 132 // Find k, as per the Step 4 of the algorithm 133 int k = 0; 134 int t = 0; 135 for (int j = 0; j <= n; j++) { 136 final int s = l1[j] + l2[n - j]; 137 if (t < s) { 138 t = s; 139 k = j; 140 } 141 } 142 143 // Step 5: solve simpler problems, recursively 144 out.append(algorithmC(leftFirstPart, right.subSequence(0, k))); 145 out.append(algorithmC(leftSecondPart, right.subSequence(k, n))); 146 } 147 148 return out.toString(); 149 } 150 151 // An auxiliary method for CharSequence reversal 152 private static String reverse(final CharSequence s) { 153 return new StringBuilder(s).reverse().toString(); 154 } 155 156 /** 157 * Calculates the longest common subsequence similarity score of two {@code CharSequence}'s passed as 158 * input. 159 * 160 *
 161 * This method implements a more efficient version of LCS algorithm which has quadratic time and 162 * linear space complexity. 163 *
 164 * 165 *
 166 * This method is based on newly implemented {@link #algorithmB(CharSequence, CharSequence)}. 167 * An evaluation using JMH revealed that this method is almost two times faster than its previous version. 168 *
 169 * 170 * @param left first character sequence 171 * @param right second character sequence 172 * @return length of the longest common subsequence of left and right 173 * @throws IllegalArgumentException if either String input {@code null} 174 */ 175 @Override 176 public Integer apply(final CharSequence left, final CharSequence right) { 177 // Quick return for invalid inputs 178 if (left == null || right == null) { 179 throw new IllegalArgumentException("Inputs must not be null"); 180 } 181 // Find lengths of two strings 182 final int leftSz = left.length(); 183 final int rightSz = right.length(); 184 185 // Check if we can avoid calling algorithmB which involves heap space allocation 186 if (leftSz == 0 || rightSz == 0) { 187 return 0; 188 } 189 190 // Check if we can save even more space 191 if (leftSz < rightSz) { 192 return algorithmB(right, left)[leftSz]; 193 } 194 return algorithmB(left, right)[rightSz]; 195 } 196 197 /** 198 * Computes the longest common subsequence between the two {@code CharSequence}'s passed as input. 199 * 200 *
 201 * Note, a substring and subsequence are not necessarily the same thing. Indeed, {@code abcxyzqrs} and 202 * {@code xyzghfm} have both the same common substring and subsequence, namely {@code xyz}. However, 203 * {@code axbyczqrs} and {@code abcxyzqtv} have the longest common subsequence {@code xyzq} because a 204 * subsequence need not have adjacent characters. 205 *
 206 * 207 *
 208 * For reference, we give the definition of a subsequence for the reader: a subsequence is a sequence that 209 * can be derived from another sequence by deleting some elements without changing the order of the remaining 210 * elements. 211 *
 212 * 213 * @param left first character sequence 214 * @param right second character sequence 215 * @return the longest common subsequence found 216 * @throws IllegalArgumentException if either String input {@code null} 217 * @deprecated Deprecated as of 1.2 due to a typo in the method name. 218 * Use {@link #longestCommonSubsequence(CharSequence, CharSequence)} instead. 219 * This method will be removed in 2.0. 220 */ 221 @Deprecated 222 public CharSequence logestCommonSubsequence(final CharSequence left, final CharSequence right) { 223 return longestCommonSubsequence(left, right); 224 } 225 226 /** 227 * Computes the longest common subsequence between the two {@code CharSequence}'s passed as 228 * input. 229 * 230 *
 231 * This method implements a more efficient version of LCS algorithm which although has quadratic time, it 232 * has linear space complexity. 233 *
 234 * 235 * 236 *
 237 * Note, a substring and subsequence are not necessarily the same thing. Indeed, {@code abcxyzqrs} and 238 * {@code xyzghfm} have both the same common substring and subsequence, namely {@code xyz}. However, 239 * {@code axbyczqrs} and {@code abcxyzqtv} have the longest common subsequence {@code xyzq} because a 240 * subsequence need not have adjacent characters. 241 *
 242 * 243 *
 244 * For reference, we give the definition of a subsequence for the reader: a subsequence is a sequence that 245 * can be derived from another sequence by deleting some elements without changing the order of the remaining 246 * elements. 247 *
 248 * 249 * @param left first character sequence 250 * @param right second character sequence 251 * @return the longest common subsequence found 252 * @throws IllegalArgumentException if either String input {@code null} 253 * @since 1.2 254 */ 255 public CharSequence longestCommonSubsequence(final CharSequence left, final CharSequence right) { 256 // Quick return 257 if (left == null || right == null) { 258 throw new IllegalArgumentException("Inputs must not be null"); 259 } 260 // Find lengths of two strings 261 final int leftSz = left.length(); 262 final int rightSz = right.length(); 263 264 // Check if we can avoid calling algorithmC which involves heap space allocation 265 if (leftSz == 0 || rightSz == 0) { 266 return ""; 267 } 268 269 // Check if we can save even more space 270 if (leftSz < rightSz) { 271 return algorithmC(right, left); 272 } 273 return algorithmC(left, right); 274 } 275 276 /** 277 * Computes the lcsLengthArray for the sake of doing the actual lcs calculation. This is the 278 * dynamic programming portion of the algorithm, and is the reason for the runtime complexity being 279 * O(m*n), where m=left.length() and n=right.length(). 280 * 281 * @param left first character sequence 282 * @param right second character sequence 283 * @return lcsLengthArray 284 * @deprecated Deprecated as of 1.10. A more efficient implementation for calculating LCS is now available. 285 * Use {@link #longestCommonSubsequence(CharSequence, CharSequence)} instead to directly calculate the LCS. 286 * This method will be removed in 2.0. 287 */ 288 @Deprecated 289 public int[][] longestCommonSubstringLengthArray(final CharSequence left, final CharSequence right) { 290 final int[][] lcsLengthArray = new int[left.length() + 1][right.length() + 1]; 291 for (int i = 0; i < left.length(); i++) { 292 for (int j = 0; j < right.length(); j++) { 293 if (i == 0) { 294 lcsLengthArray[i][j] = 0; 295 } 296 if (j == 0) { 297 lcsLengthArray[i][j] = 0; 298 } 299 if (left.charAt(i) == right.charAt(j)) { 300 lcsLengthArray[i + 1][j + 1] = lcsLengthArray[i][j] + 1; 301 } else { 302 lcsLengthArray[i + 1][j + 1] = Math.max(lcsLengthArray[i + 1][j], lcsLengthArray[i][j + 1]); 303 } 304 } 305 } 306 return lcsLengthArray; 307 } 308 309}


Websites:
UnDesign the Red Line
African American Museum of Iowa
The Shame of Iowa and the Midwest
Iowa Pathways: The Story of the Ku Klux Klan in America and In Iowa
NPR: Interactive Redlining Map Zooms in On America's History of Discrimination
"Black Laws" of 1861, 1864 and 1878, March 10,1886
Diversity and Disparities: Des Moines City
A 'Forgotten History' of How the U.S. Government Segregated America
Urban Institute
America is more diverse than
ever — but still segregated
Metro areas are still racially segregated
But it’s more complicated than “chocolate city, vanilla suburbs”
Planetizen: Racial Segregation
Racial Dot Density Map
Reports and Papers
A Farmer and the Ku Klux Klan in Northwest Iowa by Dorothy Schwieder
Public Housing Timeline, 1933-1993
Underwriting Manual of 1938
African-Americans In Iowa: 2019
Sundown Towns: A Hidden Dimension of American Racism
Housing Discrimination Against Racial and Ethnic Minorities 2012
Books
Cycle of Segregation: Social Processes and Residential Stratification
Color of Law: A Forgotten History of How Our Government Segregated America
White Fragility: Why It's So Hard for White People to Talk About Racism
So You Want to Talk About Race
American Apartheid: Segregation and the Making of the Underclass
The New Jim Crow: Mass Incarceration in the Age of Colorblindness
Between the World and Me
Sundown Towns: A Hidden Dimension of American Racism
Why I'm No Longer Talking to White People About Race
Evicted: Poverty and Profit in the American City
The Color of Money: Black Banks and the Racial Wealth Gap
Slavery by Another Name: The Re-Enslavement of Black Americans from the Civil War to World War II
Stamped from the Beginning: The Definitive History of Racist Ideas in America
Why Are All the Black Kids Sitting Together in the Cafeteria?: And Other Conversations About Race


Fabiola Cartagena
Business Analyst with an MBA and a certificate in Data Analytics from the University of Southern California. Experience in data analysis, business intelligence, and implementing initiatives that drive business growth. Critical thinker, and problem solver with the ability to communicate across all levels of the organization.


Lorry driver accused of killing 39 migrants admits assisting illegal immigration
A lorry driver accused over the deaths of 39 migrants has admitted plotting to assist unlawful immigration.
Maurice Robinson, 25, alleged to have been part of a global smuggling ring, is charged with the manslaughter of a group of men, women and children found dead in a refrigerated trailer.
The bodies of eight females and 31 males were discovered in the container attached to his Scania cab in an industrial park in Grays, Essex, early on October 23.
They were later identified as coming from various provinces of Vietnam, with the youngest being two boys aged 15.
Robinson, who is known as Mo, appeared at the Old Bailey this morning where he admitted conspiracy to assist unlawful immigration between 1 May 2018 and 24 October 2019.
The charge states that he plotted with others to do ‘an act or series of acts which facilitated the commission of a breach of immigration law by various persons’.
Advertisement Advertisement
He also admitted acquiring criminal property – namely cash – on the same dates.
Robinson, from Craigavon in Northern Ireland, is yet to enter pleas to the remaining 39 counts of manslaughter along with offences of concealing criminal property and conspiracy to traffic people.
The judge, Mr Justice Edis, said: ‘This is quite a significant investigation likely to involve investigations into other people.’
Christopher Kennedy, 23, is due to appear at Chelmsford Magistrates’ Court on Monday accused of human trafficking offences.
He was arrested in the early hours of Friday morning on the M40.
Kennedy, from Darkley in Co Armagh, is charged with conspiracy to arrange or facilitate the travel of people with a view to exploitation and conspiracy to facilitate the commission of a breach of UK immigration law.
This is a breaking news story and is being updated.


Properties¶
Children¶
TreeList<TId, T> Children
The Child objects of this node in the hierarchy as a collection of type TreeList<TId, T>
, which is a
custom implementation that derives from System.Collections.ObjectModel.Collection<T>
. A node is considered
a “branch” if the Children collection contains at least one item. A node is considered a “leaf” if the
Children collection is empty.
DepthFromRoot¶
int DepthFromRoot
Represents the number of levels in the tree that the node is in where the ROOT node is Level 1
(i.e. not zero-based like arrays). Whatever code artifact contains the Root node (i.e. whole tree)
is considered Level 0 but is not a node of the tree. DepthOfRoot
is used to calculate the
IndentString
documented below.
HasChildren¶
bool HasChildren
True if this node has Children false if not. If true then this node is considered a “branch”. If false then this node is considered a “leaf”.
IndentCharacter¶
char IndentCharacter
The character used for indentation. It will be repeated once for every Level in the tree. It is
repeated DepthFromRoot
times and returned by the IndentString
property.
IndentString¶
string IndentString
Returns the IndentCharacter
repeated DepthFromRoot
times to produce the indentation string
for pretty display in text output.
ParentId¶
TId ParentId
The Id
of the Parent
object of this node. It’s data type is customized by the TId
generic type specification.
PathId¶
string PathId
A unique identifier representing the unique path from the root to the current node. Essentially, it is a hash of the chain of hashes of ancestor Ids.
Root¶
T Root
A reference to the Root object in the tree. All objects in the tree will have the same Root.
RoodId¶
TId RootId
The Id
of the Root
object. Useful for persisting to the database when there are multiple
hierarchies in the same table differentiated by their shared Root
. It’s data type is customized
by the TId
generic type specification.
Siblings¶
TreeList<TId, T> Siblings
The other objects in the Parent
object’s Children
collection. It returns all objects in that
collection except for this node.
SortableTreePath¶
string SortableTreePath
A string representation of the location of this object in the tree in the form of a “Path”. The
SortableTreePath
is extensively documented in the SortableTreePath page.
TreeNodeId¶
Guid TreeNodeId
A unique identifer for the node. It is provided as a placeholder that is not required but can be useful.


UFO Sightings
UFOs:
They gon' getcha!
Data Filter
Filter Data
Date
City
State
Country
Shape
Duration
Comment


My Name is Luke Cardita. I am currently a Junior at Marist College. I major in Marketing, and have minors in data analysis and sports communication. I am taking an intro to programming class because it is a prerequisite for the data analysis minor, and I wanted to learn some simple coding for use in the real world
My all time favorite video game is Final Fantasy 7. The original game was released in 1997, but it was remastered with amazing graphics this year in 2020. It was one of the best ways for me to get through the quarantine, and it was really fun to see how the developers of the game changed the remake compared to the original game. Below is a picture of Cloud, the main character. Despite him being VERY anime, he's a really well written character with a good story.


- pane - Variable in class controller.MainController
-
- pattern - Variable in class model.Filehandling
-
- patternComment - Variable in class model.PatternFormat
-
- patternCornerX - Variable in class model.PatternFormat
-
- patternCornerY - Variable in class model.PatternFormat
-
- patternCreator - Variable in class model.PatternFormat
-
- PatternFormat - Class in model
-
This class parses, controls, and sets the different data that exists in a RLE file.
- PatternFormat(List<String>) - Constructor for class model.PatternFormat
-
PatternFormat
public PatternFormat({@link ArrayList} rleData)
An object of patternFormat is created using the read data from the RLE file.
- PatternFormat.RLEFormat - Enum in model
-
- PatternFormatException - Exception in model
-
An exception class which is used when a pattern is invalid.
- PatternFormatException() - Constructor for exception model.PatternFormatException
-
PatternFormatException
public PatternFormatException()
Constructs a new patternFromat Exception with no message.
- PatternFormatException(String) - Constructor for exception model.PatternFormatException
-
PatternFormatException
public PatternFormatException(String
message)
Constructs a new patternFromat Exception with a message.
- PatternFormatException(String, Throwable) - Constructor for exception model.PatternFormatException
-
PatternFormatException
public PatternFormatException(String
message,Throwable
cause)
Constructs a new patternFromat Exception with a message, and the cause of why the exception was thrown .
- PatternFormatException(Throwable) - Constructor for exception model.PatternFormatException
-
PatternFormatException
public PatternFormatException(Throwable
cause)
Constructs a new patternFromat Exception with the cause of why the exception was thrown.
- PatternFormatException(String, Throwable, boolean, boolean) - Constructor for exception model.PatternFormatException
-
PatternFormatException
public PatternFormatException(String
message,Throwable
cause,Boolean
enableSuppression),Boolean
writeableStackTrace
Constructs a new patternFromat Exception with the cause of why the exception was thrown.
- patternHeight - Variable in class model.PatternFormat
-
- patternName - Variable in class model.PatternFormat
-
- patternPosX - Variable in class model.PatternFormat
-
- patternPosY - Variable in class model.PatternFormat
-
- patternRule - Variable in class model.PatternFormat
-
- patternWidth - Variable in class model.PatternFormat
-
- patternXLife - Variable in class model.PatternFormat
-
- popupBox(Alert.AlertType, String, String, String) - Static method in class view.Viewer
-
popupBox
public static void popupBox(Alert.AlertType
alertType, String
title, String headerText, String contentText)
Displays a new JavaFX Alert
dialogue to the user.
- prevColumnClicked - Variable in class controller.MouseController
-
- previousNanotime - Variable in class controller.MainController
-
- prevMouseX - Variable in class controller.MouseController
-
- prevMouseY - Variable in class controller.MouseController
-
- prevRowClicked - Variable in class controller.MouseController
-


In desert dunes, electro fans rave about Tunisia tourism
Desert music festival enjoys boisterous revival after three-year silence ushered in by deadly attacks.
Bass rhythms boom out across the Tunisian Sahara towards a herd of camels, lasers splash colours across the dunes and VIPs sip vodka in what was once a Star Wars movie set.
The Dunes Electroniques music festival, launched in 2014, was revived last weekend on the set where US director George Lucas created the desert planet of Tatooine.
The festival marked a joyous and noisy comeback after a three-year silence following several deadly attacks in the North African country which also badly hit its tourism sector.
In a sign of the growing appeal of the remote Saharan region and its other-worldly landscapes, more than 20 international and local DJs and thousands of revellers converged on the desert site of Ong Jmal in southwest Tunisia for the two-day extravaganza.
"We had already visited Tunis, but this time we came all the way here for the festival," said Leopold Poignant, a 22-year-old student from Paris who planned to also visit the nearby oasis town of Tozeur after the party.
He said they were drawn by DJs like Adam Port and Konstantin Sibold, "but we've also come for the experience. This is a Star Wars setting and partying in the dunes is really something."
The event was held around the circular constructions built 20 years ago as settings for the Star Wars space-opera.
Ong Jmal is the best known of several sites in Tunisia where Lucas shot scenes of the youth of his hero Luke Skywalker. Each year, tens of thousands of tourists walk through the sand-swept set taking selfies.
Nomadic tents, campfires
As music played non-stop for 30 hours, those not dancing were huddled in nomadic tents set up as "chill zones" or, given the very real night-time desert chill, around camp fires.
Most of the 5,000 revellers were Tunisians, some of whom had never visited the area before.
"I'm a city girl, I don't like these traditional areas, but now there are many events in the south so I ended up coming," said Zoubeida.
Army and police were deployed around the party site, located less than 40km (25 miles) from the Algerian border.
The Dunes Electroniques music festival was launched in 2014 [Amine Landoulsi/AFP]
The 2011 revolution which toppled longtime leader Zine El Abidine Ben Ali and the attacks that killed dozens of tourists in 2015 dealt a heavy blow to Tunisia's vital tourism sector.
Although the south was not directly targeted in the attacks, visits to the region have dwindled to mostly one-night outings from coastal resorts.
"The biggest number of tourists now are Russians, and they only buy water on their way to the desert," said Nagga Ramzi, a shopkeeper with kohl-lined eyes.
"It's hard. There's nothing here but dates ... and tourism."
Tourism revival
Years after the attacks, large-scale tourism has returned to Tunisia and the south hosts a growing number of events.
A Saharan ultra-marathon, the Tozeur International Film Festival and a Sufi music festival called Rouhaniyet have all been launched.
Hotels are more often fully booked and tourists are starting to stay a little longer.

From January 1 to October 30, the number has grown by 27 percent, compared to the same period in 2016.
Some hotels are reopening, smaller guest houses have multiplied and Thai luxury hotel group Anantara is launching a five-star palace at the end of December.
Salah Akkoun, a horse carriage driver, hopes tourists will patronise local businesses and learn to "take their time" in the desert.


LAUTECH lecturers begin strike - The Nation Newspaper
Oseheye Okwuofu, Ibadan
Members of the Academic Staff Union of Universities (ASUU), Ladoke Akintola University of Technology (LAUTECH) chapter, yesterday began boycott of lectures and academic activities following the failure of the two owner states, Oyo and Osun, to meet their demands.
This decision was reached at the congress of the union held on the campus yesterday.
ASUU Chairman Dr. Biodun Olaniran said the decision was reached after reviewing the situation regarding non-payment of three months salaries.
ASUU had issued an ultimatum to the university management to pay their salaries or face strike.
Olaniran said besides the boycott of lectures, results of Rain Semester will be withheld, while students’ project defence will be put on hold.
Read Also: Osun still indebted to LAUTECH, say Oyo workers
Part of the resolutions reached at the congress include withholding of the Rain Semester results, boycott of classes by lecturers and putting on hold final year project defence.
The resolutions read: “ The Congress of ASUU met today (Monday 18/11/2019) at 250 LT, Ogbomoso. After a thorough review of the resolution of the congress of (Tuesday 05/11/2019), the congress resolved that: 2018/2019 Rain Semester results will not be released. No teaching of any form of lecture to be carried out. Final year project defence of 2018/2019 has been put on hold. The action starts immediately.”


The new package named blblm
is to fit regression models with a bag of little bootstrap.
The BLB is a combinied method of bootstrap with replacement and subsample. We will first map the data into s subsamples without replacement. And each subsample’s size is b. Then, within each subsample, BLB will bootstrap r times into each bootstrap sample with size n. The bootstrap statistics can be computed. After that, we can find the the statistics from the bootstrap statistics and take average of it.
Thus, we can see that BLB can improve the computationally efficiency and also make sure the quality of estimates. It also provides a method of pre-aggregating data before bootstrapping to reduce computational constraints.
In the blblm
package, we use the bag of little bootstrap to run two different regression models, which are linear regression, blblm()
, and logistic regression, blblog()
.
The blblm()
function can fit linear regression model on the data by BLB. This will require the users to input 4 parameters. Those are
formula
, the formula of the linear regression
data
, the data you want to fit the model
m
, the integer indicating the number of subsamples
B
, the integer indicating the number of bootstrap
parallel
, the boolean to run the function wheter use paralleization or not. Its default value is FALSE
.
Note that when choosing parallel = TRUE
, the users need to have plan(multisession, workers = 4)
to specify the number of workers they need. In this case, I chose 4 clsuters, but users can change this numer as their need.
Then, the blblm()
will return the fitted linear regression model. The user could further find the estimators’ confidence interval, standard error, prediction interval and so on.
Here is an example of the blblm()
fit1 <- blblm(mpg ~ wt * hp, data = mtcars, m = 3, B = 100, parallel = FALSE)
coef(fit1)
#> (Intercept) wt hp wt:hp
#> 41.86577931 -5.55422581 -0.08075255 0.01508193
We can find the estimated coefficient for the linear regression.
Also, we can find the confidence interval (default is 95% confidence) of the estimates, the standard error, the confidence interval of standard error, and the prediction interval.
confint(fit1, c("wt", "hp"))
#> 2.5% 97.5%
#> wt -7.7945137 -3.20863813
#> hp -0.1522348 -0.02259588
sigma(fit1)
#> [1] 1.761177
sigma(fit1, confidence = TRUE)
#> sigma lwr upr
#> 1.761177 1.162230 2.246904
predict(fit1, data.frame(wt = c(2.5, 3), hp = c(150, 170)))
#> 1 2
#> 21.52305 19.16695
predict(fit1, data.frame(wt = c(2.5, 3), hp = c(150, 170)), confidence = TRUE)
#> object lwr upr
#> 1 21.52305 19.86989 22.77035
#> 2 19.16695 17.28483 20.51708
In order to show the improved efficiency by the parallezitation method, let’s benchmark the blblm in one CPU and in four CPUs. You can notice that the running time when running parallel = TRUE
is almost half shorter than that of parallel = FALSE
.
suppressWarnings(plan(multiprocess, workers = 4))
bench::mark(blblm.par = {blblm(mpg ~ wt * hp, data = mtcars, m = 3, B = 100, parallel = FALSE)},
blblm.nonpar = {blblm(mpg ~ wt * hp, data = mtcars, m = 3, B = 100, parallel = TRUE)},
check = FALSE)
#> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
#> # A tibble: 2 x 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 blblm.par 524ms 524ms 1.91 1.1MB 3.81
#> 2 blblm.nonpar 258ms 277ms 3.61 3.65MB 0
The blblog()
function can fit logistic regression model on the data by BLB. This will also require the users to input 4 parameters. Those are
formula
, the formula of the logistic regression
data
, the data you want to fit the model
m
, the integer indicating the number of subsamples
B
, the integer indicating the number of bootstrap
parallel
, the boolean to run the function wheter use paralleization or not. Its default value is FALSE
.
Note that when choosing parallel = TRUE
, the users need to have plan(multisession, workers = 4)
to specify the number of workers they need. In this case, I chose 4 clsuters, but users can change this numer as their need.
Then, the blblog()
will return the fitted logistic regression model. The user could further find the estimators’ confidence interval, standard error, prediction interval and so on.
Here is an example of the blblog()
bi <- sample(iris[1:100,], 1000, replace = TRUE)
fit2 <- blblog(Species ~ Sepal.Width + Sepal.Length, data = bi, m = 3, B = 100, parallel = FALSE)
coef(fit2)
#> (Intercept) Sepal.Width Sepal.Length
#> -188.84917 -81.48968 83.01358
We can find the estimated coefficient for the logistic regression.
In order to show the improved efficiency by the parallezitation method, let’s benchmark the blblm in one CPU and in four CPUs. You can notice that the running time when parallel = TRUE
is shorter.
suppressWarnings(plan(multiprocess, workers = 4))
bench::mark(blblog.par = {blblog(Species ~ Sepal.Width + Sepal.Length, data = bi, m = 3, B = 100, parallel = FALSE)},
blblog.nonpar = {blblog(Species ~ Sepal.Width + Sepal.Length, data = bi, m = 3, B = 100, parallel = TRUE)},
check = FALSE)
#> # A tibble: 2 x 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 blblog.par 2s 2s 0.501 106.9MB 1.00
#> 2 blblog.nonpar 1.25s 1.25s 0.803 2.8MB 0.803
Overall, to improve the efficiency of blblm
package, I conducted two improvements. First, I added the logistic regression model so that users can fit the data into more models. Second, I added the parallelization feature for both models. Users can specify whether they want to use parallelization. Third, I tried to work on the feature which allow users to specify the list of files they want to fit the model; however, I was not getting it done to submit this project on time. I attached the code as a reference to show my work.
blblm <- function(formula, data, m = 10, B = 5000, parallel = FALSE) {
data_list <- split_data(data, m)
if (parallel == TRUE) {
map.func <- future_map
} else {
map.func <- map
}
dir.create("files", showWarnings = FALSE)
1:100 %>% walk(function(i) {
dt <- tibble(x = rnorm(5000), y = rnorm(5000))
write_csv(dt, file.path("files", sprintf("file%02d.csv", i)))
})
file_names <- file.path("files", list.files("files"))
estimates <- data_list %>% map.func(~{
df <- vroom(., col_types=cols())
lm_each_subsample(formula = formula, data = ., n = nrow(data), B = B)
})
# estimates <- map.func(
# file_names,
# ~ lm_each_subsample(formula = formula, data = ., n = nrow(data), B = B))
res <- list(estimates = estimates, formula = formula)
class(res) <- "blblm"
invisible(res)
}


In recent years, several high-quality software tools for static partitioning (e.g., Chaco [1], ParMetis [2], Jostle [3]) have been developed. These tools have enabled the use and comparison of a wide variety of different partitioning algorithms. General purpose tools for dynamic load balancing, however, have not been readily available. This fact is due to a number of differences between static and dynamic load balancing. Static partitioners are often run as a preprocessor to an application. Thus, they can easily use file-based interfaces and data structures different from those of the application. They may be implemented in serial and may use large amounts of memory and computing time. Dynamic load-balancing tools, however, must run along with the application. They must be implemented in parallel, and be fast and memory efficient to maintain the scalability of the application. They also need function-call interfaces and methods to extract data from the application's data structures. To be truly general-purpose tools, dynamic load balancers must maintain separation between the data structures of the load-balancing algorithms and the applications using them.
We will discuss the design and implementation of the Zoltan dynamic load-balancing library. Zoltan provides an object-oriented function interface between applications and load-balancing algorithms. Data needed by a load-balancing algorithm are obtained from the application through several simple call-back functions. In this way, an application's data structures are separated from those of a load-balancing algorithm. Several different load-balancing algorithms are available in the library, and since a common data structure is not required, new algorithms are easily added to the library. We will demonstrate the use of the library and assess its performance and overhead costs for finite element applications.
[1] B. Hendrickson and R. Leland. "The Chaco User's Guide, Version 2.0." Tech. Rep. SAND94-2692, Sandia National Laboratories, Albuquerque, 1994.
[2] G. Karypis and V. Kumar. "ParMetis: Parallel graph partitioning and sparse Matrix Ordering Library." Tech. Rep. 97-060, Dept. of Comp. Sci., Univ. of Minnesota, Minneapolis, 1997.
[3] C. Walshaw, M. Cross, and M. Everett. "A Parallelisable Algorithm for Optimising Unstructured Mesh Partitions." Tech. Rep. 95/IM/03, Univ. of Greenwich, London, 1995.


--- title: Don't Write Your Own E-mail Validator layout: post tags: [rant, perl] uuid: 0e9536bd-6f02-332b-e974-442f31779080 ---
Gmail has a nice feature: when delivering e-mail, everything including
and after a +
in a Gmail address is ignored. For example,
mail arriving at all of these addresses would go to the same place if
they were Gmail addresses,
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>Thanks to this feature, when a user acquires a Gmail account, Google is actually providing about a googol (as in the number 10100) different e-mail addresses to that user! Quite appropriate, really.
I have seen other mailers do similar things, like ignoring everything after dashes. A nice advantage to this is when registering at a new website I can customize my e-mail address for them by, say, throwing the website name in it. Because I have a google of e-mail addresses available, it is impossible to run out, so I can give every person I meet their own version of my address. The custom address can come in handy for sorting and filtering, and it will also tell me who is selling out my e-mail address. This, of course, assumes that someone isn't stripping out the extra text in my address to counter the Gmail feature.
However, in my personal experience, most websites will not permit
+
's in addresses. This is completely ridiculous, because
it means that virtually every website will incorrectly invalidate
perfectly valid e-mail addresses. Even major websites, like
coca-cola.com, screw this up. They see the +
in
the address and give up.
In fact, if I do a Google search for "email validation regex" right now, 9 of the first 10 results return websites with regular expressions that are complete garbage and will toss out many common, valid addresses. The only useful result was at the fifth spot (linked below).
For the love of Stallman's beard, stop writing your own e-mail address validators!
 Because the proper Perl regular expression for RFC822 is over 6 kilobytes in length! Follow that link and look at that. This is the smallest regular expression you would need to get it right.
 (Just don't forget the security issues.) Like this,
<EMAIL_ADDRESS>Seriously, if you add anything else you most almost surely make it
incorrectly reject valid addresses. Note that e-mail addresses can
contain spaces, and even more than one @
! These are
valid addresses,
"John<EMAIL_ADDRESS>"<EMAIL_ADDRESS>I have not yet found a website that will accept either of these, even though both are completely valid addresses. Even MS Outlook, which I use at work (allowing me to verify this), will refuse to send e-mail to these addresses (Gmail accepts it just fine). Hmmm... maybe having an address like these is a good anti-spam measure!
So if your e-mail address is "John<EMAIL_ADDRESS>no
one using Outlook can send you e-mail, which sounds like a feature to
me, really.
So, everyone, please stop writing e-mail validation regular expressions. The work has been done, and you will only get it wrong, guaranteed.
This is a similar rant I came across while writing mine: Stop Doing Email Validation the Wrong Way.


Phonebook Application
Search
Sort by
Alphabetical
Newest
Residence
{{phonebook.name}}
{{phonebook.mobile}}
{{phonebook.city}}
Full Name:
Your name is required.
Mobile Number:
Your Mobile number is required.
Add Contact


An object-oriented computer programming language commonly used to create interactive effects within web browsers.
A symbol that is used to perform an operation.
Containers for storing data values.
Use camel case and an underscore between words. The function variable name should match some patterns which shows that it is a function.
A "subprogram" that can be called by code external (or internal in the case of recursion) to the function. Values can be passed to a function, and the function will return a value.
Actions that can be performed on objects and contain function definitions.
The arguments object is an Array-like object corresponding to the arguments passed to a function.
A parameter is a named variable passed into a function. Parameter variables are used to import arguments into functions.
The return statement ends function execution and specifies a value to be returned to the function caller.
Method chaining, also known as named parameter idiom, is a common syntax for invoking multiple method calls in object-oriented programming languages.
The String global object is a constructor for strings, or a sequence of characters.
In computer science, a boolean is a logical data type that can have only the values true or false. A boolean is how a programming language lets you represent true and false.
The global undefined property represents the primitive value undefined. It is one of JavaScript's primitive types.
The global NaN property is a value representing Not-A-Number.
The deprecated escape() function computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.
method displays an alert dialog with the optional specified content.
add explanatory notes to the code or to prevent the browser from interpreting specific parts of the style sheet. By design, comments have no effect on the layout of a document
JavaScript Library that focuses on simplifying DOM manipulation, AJAX calls, and Event handling. It is used by JavaScript developers frequently.
extends a tag, changing its behavior or providing metadata. An attribute always has the form name=value (the attribute's identifier followed by its associated value).
Loops offer a quick and easy way to do something repeatedly.


Please's usual model for build targets is that they're built in isolation from one another, by executing a command in a known directory that generates the expected outputs. In most cases this is great since it helps guarantee reproducibility, but sometimes it can be less than ideal - say your command has quite a lot of overhead to start up which you'd like to amortise between multiple invocations.
A motivating example here was the Java compiler which has a lot more startup
overhead than natively implemented compilers (e.g.
gcc
, clang
or
go tool compile
). Most Java build tools mitigate
this by starting a single instance of it which is then reused to compile
multiple packages.
Please supports a similar concept; it can be instructed to start workers as inferior processes that it manages the lifetime of. They are specified on a rule as follows:
genrule(
name = "my_rule",
srcs = ["in.txt"],
outs = ["out.txt"],
tools = ["//tools:my_worker"],
cmd = "$(worker //tools:my_worker) --do_work",
)
The worker itself must be marked as binary and will be built first if needed (it can also be a simple command if the tool is available globally).
Please communicates with the tool over stdin / stdout as a series of JSON
messages. The structures in each direction are documented in
src/worker/types.go; essentially it gets one message per build target with some extra
metadata, and responds describing whther it was successful or not.
There's a minimal implementation of a worker in
test/workers/worker.go, and a more complete example implementing a persistent Java compiler in
the
please-java
repository.
Any messages that the process prints to its stderr will be consumed by Please and surfaced as errors; this provides a channel for the process to warn if things are going seriously wrong for some reason (i.e. more than just normal compile failures.
A similar mechanism exists for tests to share resources in the nature of common fixture setup, but that can be shared between multiple separate test targets. They work in very much the same way as when building and the same principles above apply.
The main conceptual difference is that the test worker is not responsible for actually executing the tests; Please still does that, and the worker simply does whatever setup is needed and responds back indicating when each test should begin.


WARNING FOR AVAST AND AVG USERS:
Important Flashpoint components will be detected as a virus and quarantined; this is a false positive. Follow these instructions to make an exception for Flashpoint. We work hard to keep all of our downloads virus-free.
Important Flashpoint components will be detected as a virus and quarantined; this is a false positive. Follow these instructions to make an exception for Flashpoint. We work hard to keep all of our downloads virus-free.
All Flashpoint downloads are portable, free-of-charge and built with open-source software (obviously not including the games and their respective platforms). Much of the open-source code is original to the project, which you can find at our GitHub team page here.
For info on installing and using Flashpoint, please refer to the manual or the Common Issues section below. To find out what's changed since the beginning of time, see the changelog. Warning: it's big.
Supported operating systems: Windows 7 SP1, Windows 8.1, Windows 10 (experimental Mac and Linux versions are also available)
Prerequisites: Visual C++ 2015 Redistributable, Microsoft .NET Framework 4.7 (7-Zip is required to extract Ultimate and Core)
Flashpoint 10 Ultimate
⤋ Download Torrent (Fast) - Direct Download (Slow) - Mirror
Size: 600GB download, 700GB when extracted
The full collection, targeted towards archivists and data hoarders. Available both as a torrent and as a direct download; qBittorrent and Free Download Manager are recommended for each option, respectively. A dedicated updater is also available.
Disclaimer: All content included in Flashpoint Ultimate abides by United States law. However, this may not be the case for other countries. Download at your own risk.
Flashpoint 10 Infinity
⤋ Download Self-Extracting Package - Mirror
Size: 650MB download, 2.5GB when installed; filesize increases with use
The lightweight alternative to Ultimate. Games are downloaded as you play them, logos and screenshots aren't downloaded until they're needed. Internet is required when playing a game for the first time, but downloaded games can be played offline afterwards. You will need to download it again for major updates.
Flashpoint 10 Core (Curators Only)
⤋ Download 7Z Archive
A copy of the Flashpoint launcher that is tailored specifically to project contributors. Contains only example entries for each platform as well as helpful tools for curation. If you're interested in adding games and animations to Flashpoint, please read the curation tutorial.
Common Issues
⤋ Download Torrent (Fast) - Direct Download (Slow) - Mirror
Size: 600GB download, 700GB when extracted
The full collection, targeted towards archivists and data hoarders. Available both as a torrent and as a direct download; qBittorrent and Free Download Manager are recommended for each option, respectively. A dedicated updater is also available.
Disclaimer: All content included in Flashpoint Ultimate abides by United States law. However, this may not be the case for other countries. Download at your own risk.
Flashpoint 10 Infinity
⤋ Download Self-Extracting Package - Mirror
Size: 650MB download, 2.5GB when installed; filesize increases with use
The lightweight alternative to Ultimate. Games are downloaded as you play them, logos and screenshots aren't downloaded until they're needed. Internet is required when playing a game for the first time, but downloaded games can be played offline afterwards. You will need to download it again for major updates.
Flashpoint 10 Core (Curators Only)
⤋ Download 7Z Archive
A copy of the Flashpoint launcher that is tailored specifically to project contributors. Contains only example entries for each platform as well as helpful tools for curation. If you're interested in adding games and animations to Flashpoint, please read the curation tutorial.
All games are opening to a white screen.
This is commonly caused by antivirus interference. Read this article for instructions on how to make an exception and what to do afterwards. If the issue is still occurring, ensure that Flashpoint isn't stored in a cloud folder such as OneDrive.
The launcher isn't displaying any games.
Re-extract Flashpoint; this issue is typically the result of incomplete extractions.
When opening Flashpoint, the window appears for a split second or doesn't appear at all.
Open the Task Manager and navigate to the Details tab. Look for any processes titled Flashpoint.exe and close all of them by right clicking and selecting the End task option. Then, try opening it again.
Flashpoint still isn't working!
Join the Flashpoint Discord and ask about your problem in #flashpoint-help.


Playground
Stylens Playground
ProductAI offers a custom visual search engine for your own product catalog.
Input Image
Tagging Result
Attributes
Color
Black
Texture
Floral
Stripe
Fabric
Denim
Nylon
Shape
Boxy
Fit
Style
Yoga
Retro


REVENGE A film review by Randy Parker Copyright 1996 Randy Parker
RATING: ** (out of ****)
(Review written in 1990)
In several respects, the Kevin Costner movie REVENGE is like his earlier film NO WAY OUT: each movie is about a military man having an affair with the wrong woman at the wrong time. In both films, Costner finds himself in over his head, tip toeing through a delicate situation. Both films are charged with sexual energy. However, there is a key difference between REVENGE and NO WAY OUT: NO WAY OUT didn't fall apart until its disappointing conclusion. REVENGE, on the other hand, starts to capsize immediately.
REVENGE tries to pack the emotional wallop of a BODY HEAT or FATAL ATTRACTION, but the routine story line prevents the film from delivering a knock-out blow. Costner plays Jay Cochran, a recently retired navy pilot who drives down to Puerta Vallarta to visit his friend Tiburon Mendez, a powerful Mexican millionaire played by Anthony Quinn. Cochran is immediately drawn to Mendez's stunningly beautiful wife, Miryea (Madeleine Stowe), and he finds himself torn between his passion for her and his loyalty to a longtime friend. As the title suggests, REVENGE chronicles the violent repercussions of the inevitable affair.
REVENGE is a sinking vessel, but it's buoyed by its magnetic crew. As usual, Costner has that earnest, boy-next-door quality that made him so appealing in FIELD OF DREAMS. He seems like someone you'd want your sister to marry, which makes it hard to buy him as a cold-blooded killer in the second half of the film. As Miryea, Stowe exudes a tantalizing aura of mystery, vulnerability, and raw sex appeal. Quinn has the thankless task of playing a rather standard tyrant who's violent, ruthless, and unforgiving. Quinn's dynamic presence, however, makes the familiar role more distinctive than it might have been in someone else's hands.
The first half of REVENGE is moderately successful. As Costner and Stowe fall in love, the film crackles with erotic tension. The most sensuous scene has Costner trying to make lemonade as Stowe does her best to seduce him. The image of Costner nervously trying to slice lemons is far more memorable than any of the steamy sex scenes. The second half of the film, unfortunately, is unpleasantly brutal and bloody. To add insult to injury, REVENGE has a "so what?" quality about it. Aside from the gorgeous Mexican scenery, the film is unexceptional. It plods along predictably until the pull-out-the-kleenex conclusion.
Worst of all: the plot depends on the lovers' making really dumb mistakes.  If the lovers had any common sense or discretion, then the plot would crumble, making all the revenge nonsense unnecessary. But because the characters are idiots, they have no way out.
--- Randy Parker<EMAIL_ADDRESS>http://www.shoestring.org
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


[§431:14-116.5] Assigned risk pool; experience rating plan. No employer shall be placed in an assigned risk pool for workers' compensation insurance that does not utilize an experience rating plan that includes:
(1) Reasonable eligibility standards;
(2) Incentives for loss prevention;
(3) Sufficient premium differentials to encourage safety; and
(4) Provisions for reasonable and equitable limitations on the ability of policyholders to avoid the impact of past adverse claims experience through change of ownership, control, management, or operation. [L 1995, c 234, pt of §20]


A node.js package for Steven Levithan's excellent dateFormat() function.
Date.prototype.format
method. Sorry folks, but extending native prototypes is for suckers.module.exports = dateFormat;
statement at the bottomN
to get the ISO 8601 numeric representation of the day of the week$ npm install dateformat
$ dateformat --help
As taken from Steven's post, modified to match the Modifications listed above:
var dateFormat = require('dateformat');
var now = new Date();
// Basic usage
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");
// Saturday, June 9th, 2007, 5:46:21 PM
// You can use one of several named masks
dateFormat(now, "isoDateTime");
// 2007-06-09T17:46:21
// ...Or add your own
dateFormat.masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
dateFormat(now, "hammerTime");
// 17:46! Can't touch this!
// When using the standalone dateFormat function,
// you can also provide the date as a string
dateFormat("Jun 9 2007", "fullDate");
// Saturday, June 9, 2007
// Note that if you don't include the mask argument,
// dateFormat.masks.default is used
dateFormat(now);
// Sat Jun 09 2007 17:46:21
// And if you don't include the date argument,
// the current date and time is used
dateFormat();
// Sat Jun 09 2007 17:46:22
// You can also skip the date argument (as long as your mask doesn't
// contain any numbers), in which case the current date/time is used
dateFormat("longTime");
// 5:46:22 PM EST
// And finally, you can convert local time to UTC time. Simply pass in
// true as an additional argument (no argument skipping allowed in this case):
dateFormat(now, "longTime", true);
// 10:46:21 PM UTC
// ...Or add the prefix "UTC:" or "GMT:" to your mask.
dateFormat(now, "UTC:h:MM:ss TT Z");
// 10:46:21 PM UTC
// You can also get the ISO 8601 week of the year:
dateFormat(now, "W");
// 42
// and also get the ISO 8601 numeric representation of the day of the week:
dateFormat(now,"N");
// 6
(c) 2007-2009 Steven Levithan stevenlevithan.com, MIT license.


{% verbatim %}
A PaddlePaddle program consists of two parts -- the first generates a ProgramDesc
protobuf message that describes the program, and the second runs this message using a C++ class Executor
.
A simple example PaddlePaddle program can be found in graph.md:
x = layer.data("images")
l = layer.data("label")
y = layer.fc(x)
cost = layer.mse(y, l)
optimize(cost)
train(cost, reader=mnist.train())
The first five lines of the following PaddlePaddle program generates, or, compiles, the ProgramDesc
message. The last line runs it.
The basic structure of a PaddlePaddle program is some nested blocks, as a C++ or Java program.
The concept of block comes from usual programs. For example, the following C++ program has three blocks:
int main() { // block 0
int i = 0;
if (i < 10) { // block 1
for (int j = 0; j < 10; j++) { // block 2
}
}
return 0;
}
The following PaddlePaddle program has three blocks:
import paddle as pd // block 0
x = minibatch([10, 20, 30]) # shape=[None, 1]
y = var(1) # shape=[1], value=1
z = minibatch([10, 20, 30]) # shape=[None, 1]
cond = larger_than(x, 15) # [false, true, true]
ie = pd.ifelse()
with ie.true_block(): // block 1
d = pd.layer.add_scalar(x, y)
ie.output(d, pd.layer.softmax(d))
with ie.false_block(): // block 2
d = pd.layer.fc(z)
ie.output(d, d+1)
o1, o2 = ie(cond)
BlockDesc
and ProgramDesc
All protobuf messages are defined in framework.proto
.
BlockDesc
is straight-forward -- it includes local variable definitions, vars
, and a sequence of operators, ops
.
message BlockDesc {
required int32 parent = 1;
repeated VarDesc vars = 2;
repeated OpDesc ops = 3;
}
The parent ID indicates the parent block so that operators in a block can refer to variables defined locally and also those defined in their ancestor blocks.
All hierarchical blocks in a program are flattened and stored in an array. The block ID is the index of the block in this array.
message ProgramDesc {
repeated BlockDesc blocks = 1;
}
The global block is the first one in the above array.
In the above example, the operator IfElseOp
has two blocks -- the true branch and the false branch.
The definition of OpDesc
shows that an operator could have some attributes:
message OpDesc {
AttrDesc attrs = 1;
...
}
and an attribute could be of type block, which is, in fact, a block ID as described above:
message AttrDesc {
required string name = 1;
enum AttrType {
INT = 1,
STRING = 2,
...
BLOCK = ...
}
required AttrType type = 2;
optional int32 block = 10; // when type == BLOCK
...
}
With this design, the InferShape function should take the following parameters:
void InferShape(int current_block,
int current_operator,
ProgramDesc* program // might change VarDesc values.
) {
...
}
where
current_block
indices into ProgramDesc::blocks
,current_operator
indices into BlockDesc::ops
.


18 #ifndef __H__OCULAR_MATH_HALF_EDGE_STRUCTS__H__
19 #define __H__OCULAR_MATH_HALF_EDGE_STRUCTS__H__
21 #include "Math/Geometry/Vertex.hpp"
HEVertex * from
The vertex this half-edge originates from.
Definition: HalfEdgeStructs.hpp:72
HEFace * face
The face this half-edge belongs to.
Definition: HalfEdgeStructs.hpp:75
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
HEVertex * to
The vertex this half-edge points to.
Definition: HalfEdgeStructs.hpp:73
Vertex * vertex
The base vertex.
Definition: HalfEdgeStructs.hpp:62
HEEdge * opposite
The opposite half-edge (starts at 'to' and points to 'from').
Definition: HalfEdgeStructs.hpp:79
Definition: HalfEdgeStructs.hpp:87
HEEdge * edge
One of the half-edges that starts at this vertex.
Definition: HalfEdgeStructs.hpp:61
Definition: HalfEdgeStructs.hpp:70
HEEdge * edge
One of the half-edges that bounds this face.
Definition: HalfEdgeStructs.hpp:89
Definition: HalfEdgeStructs.hpp:59
HEEdge * prev
The previous half-edge in this face (counter-clockwise).
Definition: HalfEdgeStructs.hpp:78
HEEdge * next
The next half-edge in this face (counter-clockwise).
Definition: HalfEdgeStructs.hpp:77