| A (62%) |
| A (44%) |
| A (41%) |
| A (17%) |
| A (26%) |
| A (16%) |
| A (19%) |
| A (38%) |
| A (31%) |
| A (30%) |
| A (30%) |
| A (37%) |
| A (34%) |
| A (27%) |
| A (0%) |
| A (29%) |
| A (30%) |
| A (26%) |
| A (28%) |
| A (30%) |
| B (0%) |
| B (17%) |
| B (19%) |
| B (19%) |
| B (19%) |
| B (26%) |
| B (25%) |
| B (28%) |
| B (25%) |
| B (26%) |
| B (0%) |
| B (26%) |
| B (26%) |
| C (0%) |
| C (26%) |
| C (27%) |
| C (26%) |
| C (13%) |
| Context (67%) |
| Context (15%) |
| Context (23%) |
| Context (15%) |
| Context (15%) |
| Context (15%) |
| Context (15%) |
| Context (15%) |
| Context (15%) |
| Context (15%) |
| Context (15%) |
| Context (15%) |
| Context (15%) |
| Context (21%) |
| Context (15%) |
| Context (0%) |
| Context (15%) |
| Context (15%) |
| Context (6%) |
| Context (15%) |
| Context (15%) |
| CreditCardCharge (0%) |
| Customer (0%) |
| Order (0%) |
| Product (0%) |
| ProductCategory (0%) |
| ProductSelection (0%) |
| Publisher (0%) |
| ShoppingCart (0%) |
| SpecialOrderProduct (0%) |
| StockedProduct (0%) |


Dear Sir, Is nice to know you and also I wish to solicit for your profound assistance. I got your contact through my quest for a reliable Business Partner who will guide and assist me to Invest my family heritage funds into a lucrative Business venture over there in future. Please maintain most confidential: My name is John Strasser, from Ivory Coast (Corte d' voire) I am a son of Honorable. Justice Strasser, of the blessed memory. My late father was a Politician and a Businessman, dealing on Precious Minerals in my Country. We held from Buake town of Ivory - Coast. My father was murdered early last month by the Rebels, who wanted to over throw the Government but they failed and now there is a serious crisis in my country between the Rebels and the Government. However, the Rebels have captured my town Buake and Killed so many people including my Father. And now left me and my sister and our aged mother. However, after the incident of the death of my father, we decide and ran to Ghana, the neighbouring country where we are now taking refuge at a Private guest house in Accra - Ghana. But before the untimely death of my father, My father told me sometime ago, that he has some huge amount of Money ($<IP_ADDRESS> USD) he deposited last year in Europe, at GLOBAL SECURITY AND FINANCE COMPANY,for safe - keeping as Precious goods of family Embodiments,Meanwhile Please see Now my family and myself have move to Ghana and also We found that my family Heritage funds are there in this Private Security Firm. However, We have secured this fond for my future family Investments and I will use part of this money to buy a House in your country where I and my family will live and I will Invest the rest Funds into solid Business Ventures over there in near future. My reasons of contacting you is because I needed an honest and reliable person, who will guide me and stand as my Partner / Trustee, during the withdrawal of my heritage funds from the Security - Firm. And we shall use your Personal or Company's Account to Remit /Transfer these funds through a Bank in Ghana. Please Note: If you indicate your willingness and full interest to assist me, I will offer you 15% of my total heritage funds, as your commission for the assistance and 5% will be set aside for any expenses that will be incurred in the course of the Transaction / Transfer. Expecting to hear from you soon. Thank you, John Strasser


-
The author would like to thank his wife Mary for her patience and support
during the long process of converting this from a piece of C code to a
template library.
-
The author would also like to thank Phil Endecott and Frank Gennari for
the improvements they've suggested and for testing. Without them this would
have taken longer to develop or performed worse.
-
float_mem_cast
was fixed
to be safe and fast thanks to Scott McMurray. That fix was critical for
a high-performance cross-platform float_sort
.
-
Thanks also for multiple helpful suggestions provided by Steven Watanabe,
Edouard Alligand, and others.
-
Initial documentation was refactored to use Quickbook by Paul A. Bristow.


Fixed Table header
Code
Company
Price
Change
Change %
AAC
AUSTRALIAN COMPANY
$1.38
+2.01
-0.36%
Made with
♥
by
Nikhil Krishnan


--- layout: post title: "First experience with HTML/CSS" subtitle: "Programming at 15 years old." date: 2015-01-26 23:45:13 -0400 background: '/img/posts/08.jpg' ---
As a 15 year old experementing with HTML and computer programming there is not alot you can know and alot more you dont know. Its mysterious and exciting when first delving into the tech world.


A cumulative grade point average (CGPA) is a calculation of the average of all of a student's total earned points divided by the possible number of points. This grading system calculates for all of his or her complete education career. Grade point averages can be unweighted (where all classes with the same number of credits have equal influence on the GPA) or weighted (where some classes are given more influence than others).
The Graduate Record Examinations (GRE) is a standardized test that is an admissions requirement for most graduate schools in the United States. According to ETS, the GRE aims to measure verbal reasoning, quantitative reasoning, analytical writing, and critical thinking skills that have been acquired over a long period of learning. The content of the GRE consists of certain specific algebra, geometry, arithmetic, and vocabulary sections.
A letter of recommendation or recommendation letter, also known as a letter of reference, reference letter or simply reference, is a document in which the writer assesses the qualities, characteristics, and capabilities of the person being recommended in terms of that individual's ability to perform a particular task or function.
Undergraduate research is the exploration of a specific topic within a field by an undergraduate student that makes an original contribution to the discipline. Students may work on their own, collaborate with faculty members, or seek enrollment in a research program within their field.
The Statement of Purpose is the single most important part of your application that will tell the admissions committee who you are, what has influenced your career path so far, your professional interests and where you plan to go from here.
Test of English as a Foreign Language (TOEFL) is a standardized test to measure the English language ability of non-native speakers wishing to enroll in English-speaking universities. The test is accepted by many English-speaking academic and professional institutions. TOEFL is one of the two major English-language tests in the world, the other being the IELTS.
College and university rankings are rankings of institutions in higher education which have been ranked on the basis of various combinations of various factors. None of the rankings give a comprehensive overview of the strengths of the institutions ranked because all select a range of easily quantifiable characteristics to base their results on.


In today's America, constructive debate about social issues has broken down. We don’t just disagree on policies anymore. We disagree about what’s true, and what news can be trusted.
Middle|Ground aims to shine a light on the imbalanced and sometimes inaccurate news we receive through social media which inform our opinions, to promote greater perspective and dialogue about issues of social importance.
Inspired by a powerful "Blue Feed Red Feed" visual created by the Wall Street Journal in 2016, Middle|Ground v1 offers side-by-side comparison of recent social media streams from the news sources deemed most trusted by people with “liberal” and “conservative” ideologies. Users can search by topic of interest and see how these topics are represented on social media by the news sources deemed "most reliable" in a large recent study by the Pew Research Center, a respected nonpartisan think tank and research hub.
In addition, Middle|Ground harnesses the Google Fact Check API to show any claims related to the topic which have been fact-checked, along with any conclusion reached on whether the claims are partly or mostly true or false.
Our team came together in Berkeley Coding Boot Camp and hatched the idea for Middle|Ground as a collaborative project.
Full Stack Web Developer, proficient in a broad range of web development technologies. I’m working on a certification of Full Stack Development from UC Berkeley extension. I have a certificate of iPhone programming from The City College of San Francisco, and a BA in Computer Graphics from The Pratt Institute School of Art and Design, in New York.
I am currently looking for full time work.
Jen brings 20+ years of experience in fundraising, marcomms and project management, and is now embracing a second career in full-stack web development. She has served in leadership roles at several prominent nonprofits including Big Brothers Big Sisters, Community Action Marin, Hispanic Scholarship Fund, St. Vincent de Paul Society, and Santa Clara University, and has consulted with numerous organizations. Jen graduated from UC Berkeley with a B.A. in English with Honors and for the past two decades, has built a successful career in nonprofit fundraising and leadership, raising millions for great causes. She has also been creating solutions with technology since the Commodore 64 was a new thing, and is now pursuing a long-held passion for technology while earning a certificate in full-stack web development at UC Berkeley Coding Boot Camp.
Donna is currently a student majoring in Business Adminstration with a focus in Finances, and minoring in Computer Science. For the past several years as a student, she has always had an interest in both the business field and also front-end and back-end web development. She is always willing to learn new things and enjoys challenging herself in new projects.
Stacey recently graduated with a BS in Chemistry from UC Irvine in Spring of 2020 and has exceptional coding skills. She hopes to someday work with developing new green technology to help combat the effects of climate change and promote sustainability,which is why she decided to join a Coding bootcamp. She hopes to make a career switch to software engineering so that she may someday transfer those skills to help out the environment.


[gecode-users] Python wrappers
Ellis Breen
spacestation9 at googlemail.com
Fri Oct 30 00:11:00 CET 2009
2009/10/29 Guido Tack <tack at ps.uni-sb.de>
> Hi Ellis,
>
>
> Ellis Breen wrote:
>
>> I'm currently looking for a free-as-in-beer constraint programming library
>> with bindings in both C/C++ and Python. It seems Logilab started a Python
>> wrapper for Gecode but never completed it. Are there any rival
>> implementations? Would it be non-trivial to use SWIG for this?
>>
>
> we're currently implementing an interface to the Numberjack Python library
> (http://4c110.ucc.ie/numberjack/home). It's work in progress, but we
> expect enough progress for it to be usable soon. The interface is generated
> using SWIG.
>
> Wow, that looks amazing... A shame there's no direct Windows support but
I'll try playing with Cygwin/MinGW.
>
> Apparently Cassowary also supports Python but I can't seem to find the
>> bindings.
>>
>> Also, has anyone attempted to integrate the Minizinc to Flatzinc compiler
>> into a project containing Gecode, to allow interpretation of Minizinc
>> scripts without using an intermediary program?
>>
>
> That's not so easy, because mzn2fzn is written in Mercury, and currently
> only available as a stand-alone program. It's should be possible to wrap
> the Mercury code in a C library, but that hasn't been done yet.
>
> Ah... I guess it's not a showstopper, anyway, just makes deployment a bit
more complicated (I am planning to use it with both Windows and Linux
Buildbot slaves for enumerating test scenarios).
> Cheers,
> Guido
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20091029/ee098b0a/attachment.htm>
More information about the gecode-users
mailing list


International Institute of Multiscale Materials Modeling
Embedded Statistical Coupling Method
Back to Multiscale Methods
Introduction
Embedded Statistical Coupling Method (ESCM) is developed by Saether and Yamakov. It uses a statistical approach to couple the MD domain with an FEA mesh.
History
Features
Applications
References
Further Reading
- A NASA technique report


We believe in the social connection that binds all of us and that this social connection is necessary towards building a more peaceful world. Therefore, our accommodations are designed with a focus on common space to encourage more social connections for our guests.
Guests at Xindy can enjoy the privacy of their own self-sufficient apartments while at the same time have access to our common space where they can meet and share stories with other travelers around the world. The idea is not to take away the comfort of private space, but rather to add more to the travel experience via the common space where sharing is encouraged.
After all, sharing is caring and we hope you’ll join us.


Stuck for reading inspiration over the summer? Try this myths and legends list when you take the Summer Reading Challenge – reserve and collect from your library:
Picture books
- Sir Scallywag and the Deadly Dragon Poo by Giles Andrea & Korky Paul
- The Very Messy Mermaid by Tracey Corderoy
- The Troll by Julia Donaldson
- The Day Louis Got Eaten by John Fardell
- How to Catch a Dragon by Caryl Hart
- Supertato by Sue Hendra
- Very Little Red Riding Hood by Teresa Heapy
- Giant by Colin McNaugthon
- Jack and the Jelly Bean Stalk by Rachael Mortimer
- The Foggy Foggy Forest by Nick Sharratt
- Dragon Stew by Steve Smallman
- Bedtime for Monsters by Ed Vere
- That’s not my Dragon by Fiona Watt
- George and the Dragon by Chris Wormell
Beginner reads and short chapter books
- The Frog Emperor by Anne Adeney
- The Monster Crisp Guzzler by Malorie Blackman
- Too Many Webs for Anansi by Malachy Doyle
- Robin Hood’s Day by Josephine Feeney
- Cara and the Wizard by Liz Flanagan
- The Gold-giving Snake by Mick Gowar
- Benny and the Monster by Sue Graves
- The Wooden Horse by Russell Punter
- Big Fright by A B Saddlewick
Junior novels
- Arrowhead by Ruth Eastham
- Dragon Shield by Charlie Fletcher
- Muncle Trogg by Janet Foxley
- Blackberry Blue by Jamila Gavin
- Young Knights of the Round Table by Julia Golding
- Let Sleeping Monsters Lie and Other Cautionary Tales by Eva Ibbotson
- The Dragonsitter’s Island by Josh Lacey
- First Aid for Fairies and Other Fabled Beasts by Don Lari
- Sea Monsters and Other Delicacies by Matthew Morgan
- The Secret Kingdom by Jenny Nimmo
- Goblins by Philip Reeve
- The Sword of Kuhomi by Jason Rohan
- Really Weird Removals by Daniela Sacerdoti
- Hagurosan by Darren Shan
- Muddle Earth by Paul Stewart
- The Dragon’s Song by Claire Taylor-Smith
- Fleeced by Julia Wills
- Emily Feather and the Enchanted Door by Holly Webb


Mouse routines
These functions are declared in the main Allegro header file:
#include <allegro5/allegro.h>
ALLEGRO_MOUSE_STATE
typedef struct ALLEGRO_MOUSE_STATE ALLEGRO_MOUSE_STATE;
Public fields (read only):
- x - mouse x position
- y - mouse y position
- w, z - mouse wheel position (2D 'ball')
- buttons - mouse buttons bitfield
The zeroth bit is set if the primary mouse button is held down, the first bit is set if the secondary mouse button is held down, and so on.
See also: al_get_mouse_state, al_get_mouse_state_axis, al_mouse_button_down
al_install_mouse
bool al_install_mouse(void)
Install a mouse driver.
Returns true if successful. If a driver was already installed, nothing happens and true is returned.
al_is_mouse_installed
bool al_is_mouse_installed(void)
Returns true if al_install_mouse was called successfully.
al_uninstall_mouse
void al_uninstall_mouse(void)
Uninstalls the active mouse driver, if any. This will automatically unregister the mouse event source with any event queues.
This function is automatically called when Allegro is shut down.
al_get_mouse_num_axes
unsigned int al_get_mouse_num_axes(void)
Return the number of buttons on the mouse. The first axis is 0.
See also: al_get_mouse_num_buttons
al_get_mouse_num_buttons
unsigned int al_get_mouse_num_buttons(void)
Return the number of buttons on the mouse. The first button is 1.
See also: al_get_mouse_num_axes
al_get_mouse_state
void al_get_mouse_state(ALLEGRO_MOUSE_STATE *ret_state)
Save the state of the mouse specified at the time the function is called into the given structure.
Example:
ALLEGRO_MOUSE_STATE state;
al_get_mouse_state(&state);
if (state.buttons & 1) {
/* Primary (e.g. left) mouse button is held. */
printf("Mouse position: (%d, %d)\n", state.x, state.y);
}
if (state.buttons & 2) {
/* Secondary (e.g. right) mouse button is held. */
}
if (state.buttons & 4) {
/* Tertiary (e.g. middle) mouse button is held. */
}
See also: ALLEGRO_MOUSE_STATE, al_get_mouse_state_axis, al_mouse_button_down
al_get_mouse_state_axis
int al_get_mouse_state_axis(const ALLEGRO_MOUSE_STATE *state, int axis)
Extract the mouse axis value from the saved state. The axes are numbered from 0, in this order: x-axis, y-axis, z-axis, w-axis.
See also: ALLEGRO_MOUSE_STATE, al_get_mouse_state, al_mouse_button_down
al_mouse_button_down
bool al_mouse_button_down(const ALLEGRO_MOUSE_STATE *state, int button)
Return true if the mouse button specified was held down in the state specified. Unlike most things, the first mouse button is numbered 1.
See also: ALLEGRO_MOUSE_STATE, al_get_mouse_state, al_get_mouse_state_axis
al_set_mouse_xy
bool al_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y)
Try to position the mouse at the given coordinates on the given display. The mouse movement resulting from a successful move will generate an ALLEGRO_EVENT_MOUSE_WARPED event.
Returns true on success, false on failure.
See also: al_set_mouse_z, al_set_mouse_w
al_set_mouse_z
bool al_set_mouse_z(int z)
Set the mouse wheel position to the given value.
Returns true on success, false on failure.
See also: al_set_mouse_w
al_set_mouse_w
bool al_set_mouse_w(int w)
Set the second mouse wheel position to the given value.
Returns true on success, false on failure.
See also: al_set_mouse_z
al_set_mouse_axis
bool al_set_mouse_axis(int which, int value)
Set the given mouse axis to the given value.
The axis number must not be 0 or 1, which are the X and Y axes. Use al_set_mouse_xy for that.
Returns true on success, false on failure.
See also: al_set_mouse_xy, al_set_mouse_z, al_set_mouse_w
al_get_mouse_event_source
ALLEGRO_EVENT_SOURCE *al_get_mouse_event_source(void)
Retrieve the mouse event source.
Returns NULL if the mouse subsystem was not installed.
Mouse cursors
al_create_mouse_cursor
ALLEGRO_MOUSE_CURSOR *al_create_mouse_cursor(ALLEGRO_BITMAP *bmp,
int x_focus, int y_focus)
Create a mouse cursor from the bitmap provided.
Returns a pointer to the cursor on success, or NULL on failure.
See also: al_set_mouse_cursor, al_destroy_mouse_cursor
al_destroy_mouse_cursor
void al_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor)
Free the memory used by the given cursor.
Has no effect if cursor
is NULL.
See also: al_create_mouse_cursor
al_set_mouse_cursor
bool al_set_mouse_cursor(ALLEGRO_DISPLAY *display, ALLEGRO_MOUSE_CURSOR *cursor)
Set the given mouse cursor to be the current mouse cursor for the given display.
If the cursor is currently 'shown' (as opposed to 'hidden') the change is immediately visible.
Returns true on success, false on failure.
See also: al_set_system_mouse_cursor, al_show_mouse_cursor, al_hide_mouse_cursor
al_set_system_mouse_cursor
bool al_set_system_mouse_cursor(ALLEGRO_DISPLAY *display,
ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id)
Set the given system mouse cursor to be the current mouse cursor for the given display. If the cursor is currently 'shown' (as opposed to 'hidden') the change is immediately visible.
If the cursor doesn't exist on the current platform another cursor will be silently be substituted.
The cursors are:
- ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT
- ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW
- ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY
- ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION
- ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT
- ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE
- ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N
- ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W
- ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S
- ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E
- ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW
- ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW
- ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE
- ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE
- ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS
- ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION
- ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK
- ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT
- ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE
Returns true on success, false on failure.
See also: al_set_mouse_cursor, al_show_mouse_cursor, al_hide_mouse_cursor
al_get_mouse_cursor_position
bool al_get_mouse_cursor_position(int *ret_x, int *ret_y)
On platforms where this information is available, this function returns the global location of the mouse cursor, relative to the desktop. You should not normally use this function, as the information is not useful except for special scenarios as moving a window.
Returns true on success, false on failure.
al_hide_mouse_cursor
bool al_hide_mouse_cursor(ALLEGRO_DISPLAY *display)
Hide the mouse cursor in the given display. This has no effect on what the current mouse cursor looks like; it just makes it disappear.
Returns true on success (or if the cursor already was hidden), false otherwise.
See also: al_show_mouse_cursor
al_show_mouse_cursor
bool al_show_mouse_cursor(ALLEGRO_DISPLAY *display)
Make a mouse cursor visible in the given display.
Returns true if a mouse cursor is shown as a result of the call (or one already was visible), false otherwise.
See also: al_hide_mouse_cursor
al_grab_mouse
bool al_grab_mouse(ALLEGRO_DISPLAY *display)
Confine the mouse cursor to the given display. The mouse cursor can only be confined to one display at a time.
Returns true if successful, otherwise returns false. Do not assume that the cursor will remain confined until you call al_ungrab_mouse. It may lose the confined status at any time for other reasons.
Note: not yet implemented on Mac OS X.
See also: al_ungrab_mouse
al_ungrab_mouse
bool al_ungrab_mouse(void)
Stop confining the mouse cursor to any display belonging to the program.
Note: not yet implemented on Mac OS X.
See also: al_grab_mouse


p
The bit position in the range [1,32] (1=lsb).de.polygonal.core.util.AssertionError
Position out of range (if debug flag is set).p
The bit position in the range [1,32] (1=lsb).de.polygonal.core.util.AssertionError
Position out of range (if debug flag is set).p
The bit position in the range [1,32] (1=lsb).de.polygonal.core.util.AssertionError
Position out of range (if debug flag is set).p
The bit position in the range [1,32] (1=lsb).de.polygonal.core.util.AssertionError
Position out of range (if debug flag is set).de.polygonal.core.util.AssertionError
Invalid range (if debug flag is set).


Diet and Lifestyle go hand in hand to optimize overall well-being.
Learn more about :
• How to identify stress, identify stress triggers and understand the impacts stress had on overall health and functioning.
• Understand why you have peaks and dips in your energy levels, and know more about your afternoon energy slumps
• Learn more about the impacts of poor sleep and how to get the quality sleep your body and brain really need.
• How important deep breathing is for the mind and body.
• How to incorporate exercise into your busy life.
Diana will support you in learning more about easy, active stress reduction and stress management strategies you can incorporate into your daily routine, regardless of how busy your life is.
Watch this space for more information.


Taking the Coursera Deep Learning Specialization, Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization course. Will post condensed notes every week as part of the review process. All material originates from the free Coursera course, taught by Andrew Ng. See deeplearning.ai for more details.
Assumes you have knowledge of Improving Deep Neural Networks, Week 2.
Table of Contents
Hyperparameter Tuning, Batch Normalization, and Programming Frameworks
Hyperparameter Tuning
Tuning Process
There are a lot of hyperparameters needed to train your neural network. How do you tune these hyperparameters?
- Learning rate $\alpha$
- Momentum term $\beta$
- Hyperparameters for ADAM $\beta_1, \beta_2, \epsilon$
- Number of layers to use
- Number of hidden units per layer
- Learning Rate Decay
- Mini-Batch Size
Order of Importance
- Alpha is important to tune. must tune
- Momentum is also important $~0.9$. should tune
- Mini-Batch Size is important as well should tune
- # of hidden units. should tune
- # Layers not as important to tune
- Learning Rate Decay not as important to tune
- Hyperparameters for ADAM are pretty much always left at defaults $\beta_1 = 0.9, \beta_2 = 0.999, \epsilon = 10^{-8}$ not as important to tune
Suggested to try random values. Don’t use a grid. When using random values, you are trying out more unique values for your parameters rather than a systematic grid approach.
It is difficult to know in advance which hyperparameters are going to be important to your problem.
Another common practice is ‘coarse to fine’. Cast a broad range, narrow range for hyper parameters once a more performant region is found.
Using an appropriate scale to pick hyperparameters
How do you pick the scale for random sampling? (0-100, 0-1, etc.)
Lets say you’re trying to find the number of hidden units in a layer.
$$ n^{[l]} = 50, \dots, 100 $$
Lets say you’re trying to find the number of layers in your neural network.
$$ \text{# layers} \leftarrow 2 \text{ to } 4 $$
Say you are searching for the hyperparameter alpha.
$$ \alpha = 0.0001, \dots, 1 $$
This is a case where you want to sample uniformly at random on a logarithmic scale.
r = 4 * np.random.rand() # r between [-4, 0]
alpha = 10 ** r # values of alpha are between 10^-4 and 10^0
Say you are trying to sample values for hyperparameter $\beta$ for exponentially weighted averages.
$$ \beta = 0.9 \dots 0.999 $$ Recall that 0.9 is like the average of last 10, and 0.999 is the average of last 1000.
This is similar to the log method of sampling.
$$ 1- \beta = 0.1 \dots 0.001 $$ Sample $r \in [-3, -1]$. Set $ 1 - \beta = 10^r$. Then, $\beta = 1-10^r $
Hyperparameters tuning in practice: Pandas vs Caviar
Remember to re-test your hyperparameters occasionally. Intuitions do get stale. Re-evaluate occasionally.
Two schools of thought:
- Panda approach: Babysit one model. Tune hyperparameters over training. Usually when you’re constrained by compute (don’t have the capacity to train many models)
- Caviar approach: Train many models in parallel. Tune hyperparameters for various models? This allows you to try a lot of different hyperparameter settings
If you have enough compute resources, do caviar.
Batch Normalization
Normalizing activations in a network
Recall that normalizing your features can speed up learning. This turns the controus of your learning problem from something that is very elongated into something that is more bowl shaped.
In a deeper model, you have many activation layers. How do you normalize the intermediate layers to help train the hidden layers? Can we normalize the values of something like $a^{[2]}$ so as to train $w^{[3]}, b^{[3]}$ faster?
Given some intermediate values in your neural net (say $z^{(1)} \dots z^{(m)}$)
Compute the mean as follows $\mu = \dfrac{1}{m} \sum\limits_{i}z^{(i)}$
Compute variance $\sigma^2 = \dfrac{1}{m} \sum\limits_{i}(z_{i} - \mu)^2$
Norm $z_{\text{norm}}^{(i)} = \dfrac{z^{(i)}-\mu}{\sqrt{\sigma^2} + \epsilon} $
takeaway
Applying normalization in the hidden layers may allow for faster training. Mean and variance are learnable and unlike the input features, may not be centered around 0. It simply ensures that your hidden units have standardized mean and variance.
Fitting Batch Normalization into a neural network
Batch norm is applied to Z. The batch normalization is governed by $\beta \text{ and } \gamma$.
The intuition is that the normalized value of Z ($ \tilde{Z} $) performs better than the un normalized value of Z ($Z$).
No relation between the beta here and ADAM algorithm betas.
In practice, batch normalization is applied on mini-batches.
Why does Batch Normalization Work?
Batch Normalization reduces covariate shift. No matter how the values of Z change, the mean and variance of these values will remain the same.
This limits the amount in which updating the parameters of the earlier layers will effect the deeper layer.
- Each minibatch is scaled by the mean/variance computed on just that mini batch.
- This adds some noise to the value $z^{[l]}$ within that minibatch. Similar to dropout, it adds some noise to each hidden layer’s activations.
- This has a slight regulariation effect.
Batch Normalization at test time
Recall Batch Normalization Functions
$$ \mu = \dfrac{1}{m} \sum\limits_i z^{(i)} $$ $$ \sigma ^2 = \dfrac{1}{m} \sum\limits_i (z^{(i)}-\mu)^2 $$ $$ z_{\text{norm}}^{(i)} = \dfrac{z^{(i)} - \mu}{\sqrt{\sigma^2 + \epsilon}} $$ $$ \tilde{z}^{(i)} = \gamma z_{\text{norm}}^{(i)} + \beta $$
Estimate $\mu$ and $\sigma^2$ using exponentially weighted average (across mini-batches).
Takeaway
When using batch normalization during test time, it doesn’t make sense to calculate mean and variance on a single example.
Therefore, mean and variance are calculated from your training examples.
In practice, exponentially weighted averages are used during training, use these values to perform your tests.
Multi-Class Classification
Softmax Regression
$$ C = \text{ # classes you are trying to classify} $$
ie) Image classifier to detect cats, dogs, and birds.
Rather than previous examples of binary classification, the neural network output layer will have $C$ outputs cooresponding the probability that it is one of your classes.
In this example, $C = 4$.
Softmax activation function:
$$ t = e^{z^{[l]}} $$ $$ t \in (4, 1) \leftarrow \text{shape} $$ $$ a^{[l]} = \dfrac{e^{z^{[l]}}}{\sum\limits^{4}_{j=1}t_i} $$ $$ a^{[l]}_i = \dfrac{t_i}{\sum\limits_{j=1}^4 t_i} $$
Training a softmax classifier
If $C=2$, then softmax reduces to logistic regression.
How to train a neural network with softmax? What is the loss function?
$$ y = \begin{bmatrix} 0 \newline 1 \newline 0 \newline 0 \end{bmatrix} \leftarrow \text{cat} $$ $$ a^{[l]} = \hat{y} = \begin{bmatrix} 0.3 \newline 0.2 \newline 0.1 \newline 0.4 \end{bmatrix} \leftarrow \text{cat, but our NN isn’t doing well}$$
$$ \mathcal{L}(\hat{y}, y) = -\sum\limits^{4}_{j=1} y_j \log{\hat{y_j}} $$
Introduction to Programming Frameworks
Deep learning frameworks
Many Frameworks!
- Caffe/Caffe2
- CNTK
- DL4J
- Keras
- Lasagne
- mxnet
- PaddlePaddle
- TensorFlow
- Theano
- Torch
Choosing deep learning frameworks
- Ease of programming (development and deployment)
- Running speed
- Truly open (open source with good governance)
TensorFlow
Motivating problem:
$$ J(w) = w^2 - 10w + 25 $$ This is our cost function. We want to minimize $w$.
import numpy as np
import tensorflow as tf
w = tf.Variable(0, dtype=tf.float32)
# because w is overloaded, you could also do
# cost = w**2 - 10*w + 25
cost = tf.add(tf.add(w**2, tf.multiply(-10., w)), 25)
train = tf.train.GradientDescentOptimizer(0.01).minimize(cost)
# idiomatic
init = tf.global_variables_initializer()
session = tf.Session()
session.run(init)
print(sess.run(w))
# idiomatic because the above three lines can be written as
# with tf.Session() as session:
# session.run(init)
# print(session.run(w))
At this point, 0.0
is printed out.
session.run(train)
print(session.run(w))
At this point, 0.1
is printed out.
for i in range(1000):
session.run(train)
print(session.run(w))
At this point 4.99999
is printed out.
How do you get training data into a tensor flow program? The following code is a modification of the above, allowing you to have dynamic coefficients.
import numpy as np
import tensorflow as tf
coefficients = np.array([[1.], [-10.], [25.]])
w = tf.Variable(0, dtype=tf.float32)
x = tf.placeholder(tf.float32, [3,1])
cost = x[0][0]*w**2 + x[1][0]*w + x[2][0]
train = tf.train.GradientDescentOptimizer(0.01).minimize(cost)
init = tf.global_variables_initializer()
session = tf.Session()
session.run(init)
print(session.run(w))
0.0
session.run(train, feed_dict={x:coefficients}) # this is how you do it
print(session.run(w))
0.1
for i in range(1000):
session.run(train, feed_dict={x:coefficients})
print(session.run(w))
4.99999


IZ*ONE's movie release confirmed to be postponed
by honeyciderThe film 'Eyes On Me: The Movie' that was said to be a collection of concert videos from various IZ*ONE stages has been officially postponed.
On November 8, the distributor said "'Eyes On Me: The Movie' is set to be premiered on November 15, however, we are so sorry to announce that the company has to delayed reluctantly the movie's premiere.”
This news follows the postponement of IZ*ONE's album release and comeback showcase.
Read the distributor's full official statement below:
"This is the distributor of the movie "Eyes On Me: The Movie".
"Eyes On Me: The Movie" is a movie depicting the actual situation of IZone's concert, which set to be premiered on November 15 (Friday), however, we are so sorry to announce that the company has to delayed reluctantly the movie's premiere.
Once again, we apologize to announce the news of unexpectedly delaying the movie’s premiere to the fans as well as the audience who are looking forward to the release of “Eyes On Me: The Movie“.
We sincerely hope to get the audience’s sympathy.
Thank you."


from __future__ import division
import torch
import math
import random
from PIL import Image, ImageOps, ImageEnhance
try:
import accimage
except ImportError:
accimage = None
import numpy as np
import numbers
import types
import collections
import warnings
from . import functional as F
__all__ = ["Compose", "ToTensor", "ToPILImage", "Normalize", "Resize", "Scale", "CenterCrop", "Pad",
"Lambda", "RandomCrop", "RandomHorizontalFlip", "RandomVerticalFlip", "RandomResizedCrop",
"RandomSizedCrop", "FiveCrop", "TenCrop", "LinearTransformation", "ColorJitter", "RandomRotation",
"Grayscale", "RandomGrayscale"]
[docs]class Compose(object):
"""Composes several transforms together.
Args:
transforms (list of ``Transform`` objects): list of transforms to compose.
Example:
>>> transforms.Compose([
>>> transforms.CenterCrop(10),
>>> transforms.ToTensor(),
>>> ])
"""
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, img):
for t in self.transforms:
img = t(img)
return img
[docs]class ToTensor(object):
"""Convert a ``PIL Image`` or ``numpy.ndarray`` to tensor.
Converts a PIL Image or numpy.ndarray (H x W x C) in the range
[0, 255] to a torch.FloatTensor of shape (C x H x W) in the range [0.0, 1.0].
"""
[docs] def __call__(self, pic):
"""
Args:
pic (PIL Image or numpy.ndarray): Image to be converted to tensor.
Returns:
Tensor: Converted image.
"""
return F.to_tensor(pic)
[docs]class ToPILImage(object):
"""Convert a tensor or an ndarray to PIL Image.
Converts a torch.*Tensor of shape C x H x W or a numpy ndarray of shape
H x W x C to a PIL Image while preserving the value range.
Args:
mode (`PIL.Image mode`_): color space and pixel depth of input data (optional).
If ``mode`` is ``None`` (default) there are some assumptions made about the input data:
1. If the input has 3 channels, the ``mode`` is assumed to be ``RGB``.
2. If the input has 4 channels, the ``mode`` is assumed to be ``RGBA``.
3. If the input has 1 channel, the ``mode`` is determined by the data type (i,e,
``int``, ``float``, ``short``).
.. _PIL.Image mode: http://pillow.readthedocs.io/en/3.4.x/handbook/concepts.html#modes
"""
def __init__(self, mode=None):
self.mode = mode
[docs] def __call__(self, pic):
"""
Args:
pic (Tensor or numpy.ndarray): Image to be converted to PIL Image.
Returns:
PIL Image: Image converted to PIL Image.
"""
return F.to_pil_image(pic, self.mode)
[docs]class Normalize(object):
"""Normalize an tensor image with mean and standard deviation.
Given mean: ``(M1,...,Mn)`` and std: ``(S1,..,Sn)`` for ``n`` channels, this transform
will normalize each channel of the input ``torch.*Tensor`` i.e.
``input[channel] = (input[channel] - mean[channel]) / std[channel]``
Args:
mean (sequence): Sequence of means for each channel.
std (sequence): Sequence of standard deviations for each channel.
"""
def __init__(self, mean, std):
self.mean = mean
self.std = std
[docs] def __call__(self, tensor):
"""
Args:
tensor (Tensor): Tensor image of size (C, H, W) to be normalized.
Returns:
Tensor: Normalized Tensor image.
"""
return F.normalize(tensor, self.mean, self.std)
[docs]class Resize(object):
"""Resize the input PIL Image to the given size.
Args:
size (sequence or int): Desired output size. If size is a sequence like
(h, w), output size will be matched to this. If size is an int,
smaller edge of the image will be matched to this number.
i.e, if height > width, then image will be rescaled to
(size * height / width, size)
interpolation (int, optional): Desired interpolation. Default is
``PIL.Image.BILINEAR``
"""
def __init__(self, size, interpolation=Image.BILINEAR):
assert isinstance(size, int) or (isinstance(size, collections.Iterable) and len(size) == 2)
self.size = size
self.interpolation = interpolation
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be scaled.
Returns:
PIL Image: Rescaled image.
"""
return F.resize(img, self.size, self.interpolation)
[docs]class Scale(Resize):
"""
Note: This transform is deprecated in favor of Resize.
"""
def __init__(self, *args, **kwargs):
warnings.warn("The use of the transforms.Scale transform is deprecated, " +
"please use transforms.Resize instead.")
super(Scale, self).__init__(*args, **kwargs)
[docs]class CenterCrop(object):
"""Crops the given PIL Image at the center.
Args:
size (sequence or int): Desired output size of the crop. If size is an
int instead of sequence like (h, w), a square crop (size, size) is
made.
"""
def __init__(self, size):
if isinstance(size, numbers.Number):
self.size = (int(size), int(size))
else:
self.size = size
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be cropped.
Returns:
PIL Image: Cropped image.
"""
return F.center_crop(img, self.size)
[docs]class Pad(object):
"""Pad the given PIL Image on all sides with the given "pad" value.
Args:
padding (int or tuple): Padding on each border. If a single int is provided this
is used to pad all borders. If tuple of length 2 is provided this is the padding
on left/right and top/bottom respectively. If a tuple of length 4 is provided
this is the padding for the left, top, right and bottom borders
respectively.
fill: Pixel fill value. Default is 0. If a tuple of
length 3, it is used to fill R, G, B channels respectively.
"""
def __init__(self, padding, fill=0):
assert isinstance(padding, (numbers.Number, tuple))
assert isinstance(fill, (numbers.Number, str, tuple))
if isinstance(padding, collections.Sequence) and len(padding) not in [2, 4]:
raise ValueError("Padding must be an int or a 2, or 4 element tuple, not a " +
"{} element tuple".format(len(padding)))
self.padding = padding
self.fill = fill
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be padded.
Returns:
PIL Image: Padded image.
"""
return F.pad(img, self.padding, self.fill)
[docs]class Lambda(object):
"""Apply a user-defined lambda as a transform.
Args:
lambd (function): Lambda/function to be used for transform.
"""
def __init__(self, lambd):
assert isinstance(lambd, types.LambdaType)
self.lambd = lambd
def __call__(self, img):
return self.lambd(img)
[docs]class RandomCrop(object):
"""Crop the given PIL Image at a random location.
Args:
size (sequence or int): Desired output size of the crop. If size is an
int instead of sequence like (h, w), a square crop (size, size) is
made.
padding (int or sequence, optional): Optional padding on each border
of the image. Default is 0, i.e no padding. If a sequence of length
4 is provided, it is used to pad left, top, right, bottom borders
respectively.
"""
def __init__(self, size, padding=0):
if isinstance(size, numbers.Number):
self.size = (int(size), int(size))
else:
self.size = size
self.padding = padding
@staticmethod
def get_params(img, output_size):
"""Get parameters for ``crop`` for a random crop.
Args:
img (PIL Image): Image to be cropped.
output_size (tuple): Expected output size of the crop.
Returns:
tuple: params (i, j, h, w) to be passed to ``crop`` for random crop.
"""
w, h = img.size
th, tw = output_size
if w == tw and h == th:
return 0, 0, h, w
i = random.randint(0, h - th)
j = random.randint(0, w - tw)
return i, j, th, tw
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be cropped.
Returns:
PIL Image: Cropped image.
"""
if self.padding > 0:
img = F.pad(img, self.padding)
i, j, h, w = self.get_params(img, self.size)
return F.crop(img, i, j, h, w)
[docs]class RandomHorizontalFlip(object):
"""Horizontally flip the given PIL Image randomly with a probability of 0.5."""
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be flipped.
Returns:
PIL Image: Randomly flipped image.
"""
if random.random() < 0.5:
return F.hflip(img)
return img
[docs]class RandomVerticalFlip(object):
"""Vertically flip the given PIL Image randomly with a probability of 0.5."""
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be flipped.
Returns:
PIL Image: Randomly flipped image.
"""
if random.random() < 0.5:
return F.vflip(img)
return img
[docs]class RandomResizedCrop(object):
"""Crop the given PIL Image to random size and aspect ratio.
A crop of random size (default: of 0.08 to 1.0) of the original size and a random
aspect ratio (default: of 3/4 to 4/3) of the original aspect ratio is made. This crop
is finally resized to given size.
This is popularly used to train the Inception networks.
Args:
size: expected output size of each edge
scale: range of size of the origin size cropped
ratio: range of aspect ratio of the origin aspect ratio cropped
interpolation: Default: PIL.Image.BILINEAR
"""
def __init__(self, size, scale=(0.08, 1.0), ratio=(3. / 4., 4. / 3.), interpolation=Image.BILINEAR):
self.size = (size, size)
self.interpolation = interpolation
self.scale = scale
self.ratio = ratio
@staticmethod
def get_params(img, scale, ratio):
"""Get parameters for ``crop`` for a random sized crop.
Args:
img (PIL Image): Image to be cropped.
scale (tuple): range of size of the origin size cropped
ratio (tuple): range of aspect ratio of the origin aspect ratio cropped
Returns:
tuple: params (i, j, h, w) to be passed to ``crop`` for a random
sized crop.
"""
for attempt in range(10):
area = img.size[0] * img.size[1]
target_area = random.uniform(*scale) * area
aspect_ratio = random.uniform(*ratio)
w = int(round(math.sqrt(target_area * aspect_ratio)))
h = int(round(math.sqrt(target_area / aspect_ratio)))
if random.random() < 0.5:
w, h = h, w
if w <= img.size[0] and h <= img.size[1]:
i = random.randint(0, img.size[1] - h)
j = random.randint(0, img.size[0] - w)
return i, j, h, w
# Fallback
w = min(img.size[0], img.size[1])
i = (img.size[1] - w) // 2
j = (img.size[0] - w) // 2
return i, j, w, w
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be flipped.
Returns:
PIL Image: Randomly cropped and resize image.
"""
i, j, h, w = self.get_params(img, self.scale, self.ratio)
return F.resized_crop(img, i, j, h, w, self.size, self.interpolation)
[docs]class RandomSizedCrop(RandomResizedCrop):
"""
Note: This transform is deprecated in favor of RandomResizedCrop.
"""
def __init__(self, *args, **kwargs):
warnings.warn("The use of the transforms.RandomSizedCrop transform is deprecated, " +
"please use transforms.RandomResizedCrop instead.")
super(RandomSizedCrop, self).__init__(*args, **kwargs)
[docs]class FiveCrop(object):
"""Crop the given PIL Image into four corners and the central crop
.. Note::
This transform returns a tuple of images and there may be a mismatch in the number of
inputs and targets your Dataset returns. See below for an example of how to deal with
this.
Args:
size (sequence or int): Desired output size of the crop. If size is an ``int``
instead of sequence like (h, w), a square crop of size (size, size) is made.
Example:
>>> transform = Compose([
>>> FiveCrop(size), # this is a list of PIL Images
>>> Lambda(lambda crops: torch.stack([ToTensor()(crop) for crop in crops])) # returns a 4D tensor
>>> ])
>>> #In your test loop you can do the following:
>>> input, target = batch # input is a 5d tensor, target is 2d
>>> bs, ncrops, c, h, w = input.size()
>>> result = model(input.view(-1, c, h, w)) # fuse batch size and ncrops
>>> result_avg = result.view(bs, ncrops, -1).mean(1) # avg over crops
"""
def __init__(self, size):
self.size = size
if isinstance(size, numbers.Number):
self.size = (int(size), int(size))
else:
assert len(size) == 2, "Please provide only two dimensions (h, w) for size."
self.size = size
def __call__(self, img):
return F.five_crop(img, self.size)
[docs]class TenCrop(object):
"""Crop the given PIL Image into four corners and the central crop plus the flipped version of
these (horizontal flipping is used by default)
.. Note::
This transform returns a tuple of images and there may be a mismatch in the number of
inputs and targets your Dataset returns. See below for an example of how to deal with
this.
Args:
size (sequence or int): Desired output size of the crop. If size is an
int instead of sequence like (h, w), a square crop (size, size) is
made.
vertical_flip(bool): Use vertical flipping instead of horizontal
Example:
>>> transform = Compose([
>>> TenCrop(size), # this is a list of PIL Images
>>> Lambda(lambda crops: torch.stack([ToTensor()(crop) for crop in crops])) # returns a 4D tensor
>>> ])
>>> #In your test loop you can do the following:
>>> input, target = batch # input is a 5d tensor, target is 2d
>>> bs, ncrops, c, h, w = input.size()
>>> result = model(input.view(-1, c, h, w)) # fuse batch size and ncrops
>>> result_avg = result.view(bs, ncrops, -1).mean(1) # avg over crops
"""
def __init__(self, size, vertical_flip=False):
self.size = size
if isinstance(size, numbers.Number):
self.size = (int(size), int(size))
else:
assert len(size) == 2, "Please provide only two dimensions (h, w) for size."
self.size = size
self.vertical_flip = vertical_flip
def __call__(self, img):
return F.ten_crop(img, self.size, self.vertical_flip)
class LinearTransformation(object):
"""Transform a tensor image with a square transformation matrix computed
offline.
Given transformation_matrix, will flatten the torch.*Tensor, compute the dot
product with the transformation matrix and reshape the tensor to its
original shape.
Applications:
- whitening: zero-center the data, compute the data covariance matrix
[D x D] with np.dot(X.T, X), perform SVD on this matrix and
pass it as transformation_matrix.
Args:
transformation_matrix (Tensor): tensor [D x D], D = C x H x W
"""
def __init__(self, transformation_matrix):
if transformation_matrix.size(0) != transformation_matrix.size(1):
raise ValueError("transformation_matrix should be square. Got " +
"[{} x {}] rectangular matrix.".format(*transformation_matrix.size()))
self.transformation_matrix = transformation_matrix
def __call__(self, tensor):
"""
Args:
tensor (Tensor): Tensor image of size (C, H, W) to be whitened.
Returns:
Tensor: Transformed image.
"""
if tensor.size(0) * tensor.size(1) * tensor.size(2) != self.transformation_matrix.size(0):
raise ValueError("tensor and transformation matrix have incompatible shape." +
"[{} x {} x {}] != ".format(*tensor.size()) +
"{}".format(self.transformation_matrix.size(0)))
flat_tensor = tensor.view(1, -1)
transformed_tensor = torch.mm(flat_tensor, self.transformation_matrix)
tensor = transformed_tensor.view(tensor.size())
return tensor
[docs]class ColorJitter(object):
"""Randomly change the brightness, contrast and saturation of an image.
Args:
brightness (float): How much to jitter brightness. brightness_factor
is chosen uniformly from [max(0, 1 - brightness), 1 + brightness].
contrast (float): How much to jitter contrast. contrast_factor
is chosen uniformly from [max(0, 1 - contrast), 1 + contrast].
saturation (float): How much to jitter saturation. saturation_factor
is chosen uniformly from [max(0, 1 - saturation), 1 + saturation].
hue(float): How much to jitter hue. hue_factor is chosen uniformly from
[-hue, hue]. Should be >=0 and <= 0.5.
"""
def __init__(self, brightness=0, contrast=0, saturation=0, hue=0):
self.brightness = brightness
self.contrast = contrast
self.saturation = saturation
self.hue = hue
@staticmethod
def get_params(brightness, contrast, saturation, hue):
"""Get a randomized transform to be applied on image.
Arguments are same as that of __init__.
Returns:
Transform which randomly adjusts brightness, contrast and
saturation in a random order.
"""
transforms = []
if brightness > 0:
brightness_factor = np.random.uniform(max(0, 1 - brightness), 1 + brightness)
transforms.append(Lambda(lambda img: F.adjust_brightness(img, brightness_factor)))
if contrast > 0:
contrast_factor = np.random.uniform(max(0, 1 - contrast), 1 + contrast)
transforms.append(Lambda(lambda img: F.adjust_contrast(img, contrast_factor)))
if saturation > 0:
saturation_factor = np.random.uniform(max(0, 1 - saturation), 1 + saturation)
transforms.append(Lambda(lambda img: F.adjust_saturation(img, saturation_factor)))
if hue > 0:
hue_factor = np.random.uniform(-hue, hue)
transforms.append(Lambda(lambda img: F.adjust_hue(img, hue_factor)))
np.random.shuffle(transforms)
transform = Compose(transforms)
return transform
def __call__(self, img):
"""
Args:
img (PIL Image): Input image.
Returns:
PIL Image: Color jittered image.
"""
transform = self.get_params(self.brightness, self.contrast,
self.saturation, self.hue)
return transform(img)
class RandomRotation(object):
"""Rotate the image by angle.
Args:
degrees (sequence or float or int): Range of degrees to select from.
If degrees is a number instead of sequence like (min, max), the range of degrees
will be (-degrees, +degrees).
resample ({PIL.Image.NEAREST, PIL.Image.BILINEAR, PIL.Image.BICUBIC}, optional):
An optional resampling filter.
See http://pillow.readthedocs.io/en/3.4.x/handbook/concepts.html#filters
If omitted, or if the image has mode "1" or "P", it is set to PIL.Image.NEAREST.
expand (bool, optional): Optional expansion flag.
If true, expands the output to make it large enough to hold the entire rotated image.
If false or omitted, make the output image the same size as the input image.
Note that the expand flag assumes rotation around the center and no translation.
center (2-tuple, optional): Optional center of rotation.
Origin is the upper left corner.
Default is the center of the image.
"""
def __init__(self, degrees, resample=False, expand=False, center=None):
if isinstance(degrees, numbers.Number):
if degrees < 0:
raise ValueError("If degrees is a single number, it must be positive.")
self.degrees = (-degrees, degrees)
else:
if len(degrees) != 2:
raise ValueError("If degrees is a sequence, it must be of len 2.")
self.degrees = degrees
self.resample = resample
self.expand = expand
self.center = center
@staticmethod
def get_params(degrees):
"""Get parameters for ``rotate`` for a random rotation.
Returns:
sequence: params to be passed to ``rotate`` for random rotation.
"""
angle = np.random.uniform(degrees[0], degrees[1])
return angle
def __call__(self, img):
"""
img (PIL Image): Image to be rotated.
Returns:
PIL Image: Rotated image.
"""
angle = self.get_params(self.degrees)
return F.rotate(img, angle, self.resample, self.expand, self.center)
[docs]class Grayscale(object):
"""Convert image to grayscale.
Args:
num_output_channels (int): (1 or 3) number of channels desired for output image
Returns:
PIL Image: Grayscale version of the input.
- If num_output_channels == 1 : returned image is single channel
- If num_output_channels == 3 : returned image is 3 channel with r == g == b
"""
def __init__(self, num_output_channels=1):
self.num_output_channels = num_output_channels
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be converted to grayscale.
Returns:
PIL Image: Randomly grayscaled image.
"""
return F.to_grayscale(img, num_output_channels=self.num_output_channels)
[docs]class RandomGrayscale(object):
"""Randomly convert image to grayscale with a probability of p (default 0.1).
Args:
p (float): probability that image should be converted to grayscale.
Returns:
PIL Image: Grayscale version of the input image with probability p and unchanged
with probability (1-p).
- If input image is 1 channel: grayscale version is 1 channel
- If input image is 3 channel: grayscale version is 3 channel with r == g == b
"""
def __init__(self, p=0.1):
self.p = p
def __call__(self, img):
"""
Args:
img (PIL Image): Image to be converted to grayscale.
Returns:
PIL Image: Randomly grayscaled image.
"""
num_output_channels = 1 if img.mode == 'L' else 3
if random.random() < self.p:
return F.to_grayscale(img, num_output_channels=num_output_channels)
return img


Hyperledger Composer Modeling Language
Hyperledger Composer includes an object-oriented modeling language that is used to define the domain model for a business network definition.
A Hyperledger Composer CTO file is composed of the following elements:
- A single namespace. All resource declarations within the file are implicitly in this namespace.
- A set of resource definitions, encompassing assets, transactions, participants, and events.
- Optional import declarations that import resources from other namespaces.
Organization and Hyperledger Composer System Namespaces
Your organization namespace is defined in the namespace line of your model (.cto
) file, and all resources created are implicitly part of this namespace.
As well as defining new classes of asset, participant, event, and transaction, there is a system namespace which contains the base definitions of asset, event, participant, and transaction. These base definitions are abstract types which are implicitly extended by all assets, events, participants, and transactions.
In the system namespace definitions, asset and participant have no required values. Events and transactions are defined by an eventId or transactionId and a timestamp. The system namespace also includes definitions of registries, historian records, identities, and a number of system transactions.
If you have defined an event or transaction including an eventId, transactionId, or timestamp, you must delete the eventId, transactionId, or timestamp properties.
Declarations of resources
Resources in Hyperledger Composer include:
- Assets, Participants, Transactions, and Events.
- Enumerated Types.
- Concepts.
Assets, Participants and Transactions are class definitions. The concepts of Asset, Participant and Transaction may be considered to be different stereotypes of the class type.
A class in Hyperledger Composer is referred to as a Resource Definition, therefore an asset instance has an Asset Definition.
A resource definition has the following properties:
- A namespace defined by the namespace of its parent file. The namespace of a
.cto
file implicitly applies to all resources created in it. A name, for example
Vehicle
, and an identifying field, for example,vin
. If the resource is an asset or participant, the name is followed by the identifying field, if the resource is an event or transaction, the identifying field is set automatically. In this example, the asset is namedVehicle
and the identifying field isvin
./** * A vehicle asset. */ asset Vehicle identified by vin { o String vin }
An optional super-type, which the resource definition extends. The resource will take all properties and fields required by the super-type and add any additional properties or fields from its own definition.
/** * A car asset. A car is related to a list of parts */ asset Car extends Vehicle { o String model --> Part[] Parts }
An optional 'abstract' declaration, to indicate that this type cannot be created. Abstract resources can be used as a basis for other classes to extend. Extensions of abstract classes do not inherit the abstract status. For example, the asset
Vehicle
defined above should never be created, as there should be more specific asset classes defined to extend it./** * An abstract Vehicle asset. */ abstract asset Vehicle identified by vin { o String vin }
A set of named properties. The properties must be named, and the primitive data type defined.The properties and their data are owned by each resource, for example, a
Car
asset has avin
, and amodel
property, both of which are strings.A set of relationships to other Composer types that are not owned by the resource but that may be referenced from the resource. Relationships are unidirectional.
/**
- A Field asset. A Field is related to a list of animals */ asset Field identified by fieldId { o String fieldId o String name --> Animal[] animals }
Declarations of enumerated types
Enumerated types are used to specify a type that may have 1 or N possible values. The example below defines the ProductType enumeration, which may have the value DAIRY
or BEEF
or VEGETABLES
.
/**
* An enumerated type
*/
enum ProductType {
o DAIRY
o BEEF
o VEGETABLES
}
When another resource is created, for example, a participant, a property of that resource can be defined in terms of an enumerated type.
participant Farmer identified by farmerId {
o String farmerId
o ProductType primaryProduct
Concepts
Concepts are abstract classes that are not assets, participants or transactions. They are typically contained by an asset, participant or transaction.
For example, below an abstract concept Address
is defined, and then specialized into a UnitedStatesAddress
. Note that concepts do not have an identified by
field as they cannot be directly stored in registries or referenced in relationships.
abstract concept Address {
o String street
o String city default ="Winchester"
o String country default = "UK"
o Integer[] counts optional
}
concept UnitedStatesAddress extends Address {
o String zipcode
}
Primitive types
Composer resources are defined in terms of the following primitive types:
- String: a UTF8 encoded String.
- Double: a double precision 64 bit numeric value.
- Integer: a 32 bit signed whole number.
- Long: a 64 bit signed whole number.
- DateTime: an ISO-8601 compatible time instance, with optional time zone and UTZ offset.
- Boolean: a Boolean value, either true or false.
Arrays
All types in Composer may be declared as arrays using the [] notation.
Integer[] integerArray
Is an array of Integers stored in a field called 'integerArray'. While
--> Animal[] incoming
Is an array of relationships to the Animal type, stored in a field called 'incoming'.
Relationships
A relationship in the Composer language is a tuple composed of:
- The namespace of the type being referenced
- The type name of the type being referenced
- The identifier of the instance being referenced
Hence a relationship could be to: org.example.Vehicle#123456
This would be a relationship to the Vehicle type declared in the org.example namespace with the identifier 123456.
Relationships are unidirectional and deletes do not cascade, ie. removing the relationship has no impact on the thing that is being pointed to. Removing the thing being pointed to does not invalidate the relationship.
Relationships must be resolved to retrieve an instance of the object being referenced. The act of resolution may result in null, if the object no longer exists or the information in the relationship is invalid.
Field Validators
String fields may include an optional regular expression, which is used to validate the contents of the field. Careful use of field validators allows Composer to perform rich data validation, leading to fewer errors and less boilerplate code.
The example below declares that the Farmer
participant contains a field postcode
that must conform to the regular expression for valid UK postcodes.
participant Farmer extends Participant {
o String firstName default="Old"
o String lastName default="McDonald"
o String address1
o String address2
o String county
o String postcode regex=/(GIR 0AA)|((([A-Z-[QVf]][0-9][0-9]?)|(([A-Z-[QVf]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVf]][0-9][A-HJKPSTUW])|([A-Z-[QVf]][A-Z-[IJZ]][0-9][ABEHMNPRVWfY])))) [0-9][A-Z-[CIKMOV]]{2})/
}
Double, Long or Integer fields may include an optional range expression, which is used to validate the contents of the field.
The example below declared that the Vehicle
asset has an Integer field year
which defaults to 2016 and must be 1990, or higher. Range expressions may omit the lower or upper bound if checking is not required.
asset Vehicle extends Base {
// An asset contains Fields, each of which can have an optional default value
o String model default="F150"
o String make default="FORD"
o String reg default="ABC123"
// A numeric field can have a range validation expression
o Integer year default=2016 range=[1990,] optional // model year must be 1990 or higher
o Integer[] integerArray
o State state
o Double value
o String colour
o String V5cID regex=/^[A-z][A-z][0-9]{7}/
o String LeaseContractID
o Boolean scrapped default=false
o DateTime lastUpdate optional
--> Participant owner //relationship to a Participant, with the field named 'owner'.
--> Participant[] previousOwners optional // Nary relationship
o Customer customer
}
Imports
Use the import
keyword with a fully-qualified type name to import a type from another namespace. Alternatively use the .*
notation to import all the types from another namespace.
import org.example.MyAsset
import org.example2.*
Decorators
Resources and properties of resources may have decorators attached. Decorators are used to annotate a model with metadata. The example below adds the foo
decorator to the Buyer participant, with "arg1' and 2 passed as arguments to the decorator.
Similarly decorators can be attached to properties, relationships and enumerated values.
@foo("arg1", 2)
participant Buyer extends Person {
}
Resource definitions and properties may be decorated with 0 or more decorations. Note that only a single instance of a decorator is allowed on each element type. I.e. it is invalid to have the @bar
decorator listed twice on the same element.
Decorator Arguments
Decorators may have an arbitrary list of arguments (0 or more items). Argument values must be strings, numbers or booleans.
Decorator APIs
Decorators are accessible at runtime via the ModelManager introspect APIs. This allows external tools and utilities to use the Composer Modelling Language (CTO) file format to describe a core model, while decorating it with sufficient metadata for their own purposes.
The example below retrieves the 3rd argument to the foo decorator attached to the myField property of a class declaration:
const val = myField.getDecorator('foo').getArguments()[2];


Comoros
The Comoros,[nb 1] officially the Union of the Comoros,[nb 2] is an island
country in the Indian Ocean, at the northern end of the Mozambique Channel off the eastern coast
of Africa. It shares maritime borders with Madagascar and Mayotte to the southeast, Tanzania to
the northwest, Mozambique to the west, and the Seychelles to the northeast. Its capital and
largest city is Moroni. The religion of the majority of the population, and the official state
religion, is Sunni Islam. As a member of the Arab League, it is the only country in the Arab
world which is entirely in the Southern Hemisphere. It is also a member state of the African
Union, the Organisation internationale de la Francophonie, the Organisation of Islamic
Cooperation, and the Indian Ocean Commission. The country has three official languages:
Comorian, French and Arabic.
CONTINUE READING
June 13,2020
Chula Island
Chula is an island that is a part of the Bajuni Islands archepelago in
southern Somalia[1] in the Somali Sea. It is the most populated of the six islands.
CONTINUE READING
September 10, 2019 | 223 comments
Indian Ocean
June 15, 2021 | 5 comments
The Indian Ocean is the third-largest of the world's oceanic
divisions, covering
70,560,000 km2 (27,240,000 sq mi) or 19.8% of the water on Earth's surface.[5] It is bounded by Asia
to the north, Africa to the west and Australia to the east. To
the south it is bounded by the
Southern Ocean or Antarctica, depending on the definition in use.[6] Along its core, the Indian
Ocean has some large marginal or regional seas such as the Arabian Sea, the Laccadive Sea, the
Somali Sea, Bay of Bengal, and the Andaman Sea.
CONTINUE READING
Chula Island
Chula is an island that is a part of the Bajuni Islands archepelago in
southern Somalia[1] in the Somali Sea. It is the most populated of the six islands.
CONTINUE READING
September 10, 2019 | 223 comments
Chagos Archipelago
The Chagos Archipelago (/ˈtʃɑːɡəs, -ɡoʊs/) or Chagos Islands (formerly the
Bassas de Chagas,[2] and later the Oil Islands) is a group of seven atolls comprising more than
60 islands in the Indian Ocean about 500 kilometres (310 mi) south of the Maldives archipelago.
This chain of islands is the southernmost archipelago of the Chagos-Laccadive Ridge, a long
submarine mountain range in the Indian Ocean.[3] In the north are Peros Banhos, Salomon Islands
and Nelsons Island; in the south-west are Three Brothers, Eagle, Egmont and Danger Islands.
Diego Garcia is the largest and lies in the southeast part of the Archipelago.
CONTINUE READING
january 17, 2021 | 14 comments


{% extends 'base.html' %} {% block header %}
Created by User {{ ticket.user_id }} on {{ ticket.created_on }}
Tag: {{ ticket.tag }}
{% if not ticket.is_closed %}Ticket has not been resolved
{% else %}Ticket has been resolved
{% endif %}{{ ticket.description }}
{% if not ticket.is_closed %} {% endif %}