Before Change
UserKNN.__init__(self, train_file, test_file, prediction_file=prediction_file, neighbors=neighbors,
similarity_metric=similarity_metric, space_type=space_type)
if metadata_file is None and similarity_matrix_file is None:
print("This algorithm needs a similarity matrix or a metadata file!")
sys.exit(0)
if metadata_file is not None:
self.metadata = ReadFile(metadata_file, space_type).read_metadata(self.users)
self.matrix = self.metadata["matrix"]
self.similarity_matrix_file = similarity_matrix_file
After Change
>> UserAttributeKNN(train, test, similarity_file=sim_matrix, as_similar_first=True).compute()
>> UserAttributeKNN(train, test, metadata_file=metadata, as_similar_first=True).compute()
:param train_file: File which contains the train set. This file needs to have at least 3 columns
(user item feedback_value).
:type train_file: str
:param test_file: File which contains the test set. This file needs to have at least 3 columns
(user item feedback_value).
:type test_file: str, default None
:param output_file: File with dir to write the final predictions


|
Contiki 2.5
|
Directories | |
| directory | dev |
Files | |
| file | button.c [code] |
| file | cc2420-arch-sfd.c [code] |
| file | cc2420-arch-sfd.h [code] |
| file | cc2420-arch.c [code] |
| file | clock.c [code] |
| file | flash.c [code] |
Functions for reading and writing flash ROM. | |
| file | leds-arch.c [code] |
| file | loader-arch.c [code] |
| file | lpm.c [code] |
| file | minileds.c [code] |
| file | msp430.c [code] |
| file | msp430def.h [code] |
| file | mtarch.c [code] |
| file | mtarch.h [code] |
| file | rom.c [code] |
| file | rtimer-arch.c [code] |
MSP430-specific rtimer code. | |
| file | rtimer-arch.h [code] |
Header file for the MSP430-specific rtimer code. | |
| file | slip_uart0.c [code] |
| file | slip_uart1.c [code] |
| file | spi.c [code] |
| file | spix.c [code] |
| file | uip-ipchksum.c [code] |
uIP checksum calculation for MSP430 | |
| file | watchdog.c [code] |


We develop high performance mobile apps for both android and iOS with a modern look and feel.
Get mobile responsive high end web apps for your personal or business use.
We design professional UI mockups for your mobile and web apps ready for development.
Get your favorite platforms integrated into your website and mobile app for more user outreach.
We also build business systes and desktop applications to get your business running efficiently.
Allow more people to connect with your business systems and products through APIs.
Afro++ (afroplusplus) is a Tech Start-up based in Johannesburg, South Africa. We are a software company that aims to keep Africa at the fore-front of the 4IR. We aim to build cutting egde technology that solves problems for our people. The internet exists to make information accessible more convienently and our duty is to build platforms that make it possible.
We develop web and mobile applications of different kinds based on our clients needs. Our team of talented developers is dedicated to using the latest technologies to push the production to its limits. We make professional elegant designs that are appealing to your target market.
Our plan is to make online presence affordable and competitive for everyone no matter how small your business is. The idea is to help our local entrepreneurs grow by connecting to as many people as possible. Thus choosing us gives you the ability to attract customers to see you just as valuable and professional as large scale businesses.
 We make impressive UI designs ready for development.


Details
-
Template in SC
Template not in SC
Template not checked
-
Branch in SC
-
Branch not in SC
Branch not checked
-
Code First
-
Not Code First
-
No Id Property
-
Id Property
| TemplateId |
|
| BranchId |
|
| Id Property |
|
| Code First |
|
| Inherited |
|
| Derived |
|
Fields
| Name |
Type |
Read Only |
Code First |
Section Name |
Field Name |
Field Id |
Field Title |
Field Type |
Field Source |
|
|
|
|
|
|
|
|
|
|
Information
Children
| Name |
Type |
Is Lazy |
Infer Type |
|
|
|
|
Parents
| Name |
Type |
Is Lazy |
Infer Type |
|
|
|
|
Queries
| Name |
Type |
Is Lazy |
Infer Type |
Is Relative |
Use Query Context |
Query |
|
|
|
|
|
|
|
Links
| Name |
Type |
Is Lazy |
Infer Type |
Option |
|
|
|
|
|
Items
| Name |
Type |
Is Lazy |
Id |
Path |
|
|
|
|
|


TOP-50
Widgets
TWITTER
TOP-50
Widgets
Follow @RebelliousCoin
Top 50 Ethereum tokens for 90 days
grouped by operations count
!!widget-ethplorer-top!!
See also
Recent Token operations monitor
Token Widgets and Charts for your website
Rebellious is currently listed on:


Bugatti In Talks With VW Group About Four-Seat Electric Car
It would be cheaper than the Chiron, but it could still cost seven figures.
by Adrian PadeanuBugatti’s W16 engine might seem like a dinosaur in the era of downsizing, but there’s still a market big enough to justify the existence of the multi-million-dollar Chiron and all of its quad-turbo 8.0-liter derivatives. That said, the folks from Molsheim can’t simply ignore what is currently going on in the industry and have to adapt by starting to think about a future when the internal combustion engine will breathe its last breath.
Being a small manufacturer that builds about 100 cars each year, it can’t simply afford to shell out the money to invest in a second product line to sit alongside the Chiron. It needs the help of its parent company, the almighty Volkswagen Group. Bugatti CEO Stephan Winkelman told Bloomberg during an interview held in Berlin that getting the seal of approval from VAG is going to be a “hard fight.”
Gallery: Bugatti Galibier concept
Lamborghini’s former boss says Bugatti is currently “earning decent money” in contrast to the Veyron days as the first model developed and sold under VW’s umbrella was hardly profitable. An article published by Business Insider in 2013 quoted Wall Street research firm Bernstein Research saying the company was losing at that time a whopping $6.24 million for each Veyron sold. The people behind the report said those numbers shouldn’t be taken “too seriously,” but at the Chiron’s unveiling, Bugatti told The Verge they finally have a profitable car as opposed to the Veyron.
Fast forward to 2019, Bugatti is thinking about a four-seat electric vehicle priced anywhere between €500,000 and €1,000,000 (about $553,000 to $1.1 million at current exchange rates). It’s set to take the shape of a grand tourer or even a crossover, according to the Bloomberg report. Bugatti’s days of chasing speed records are behind it as the company wants to explore other territories in the ultra-luxury realm, with a more affordable car being a distinct possibility.
Bugatti's Speed Demon:
With fewer than 100 Chirons still up for grabs, surely there’s something on Bugatti’s agenda to keep the brand relevant as we are gradually entering the electrified era.
P.S. Bring back the Galibier!
Source: Bloomberg


menu
search
Search
Sign in
arrow_drop_down
Sign in
Register
shopping_cart
search
Search
Sign in
arrow_drop_down
Sign in
Register
LUGGAGE
TRAVEL ACCESSORIES
CLOTHINGS
SPECIAL PACKAGES
PACKING TIPS
LUGGAGE
TRAVEL ACCESSORIES
CLOTHINGS
SPECIAL PACKAGES
PACKING TIPS
Shipment Information
Edit
First Name
Last Name
Address
City
Zip code
State
Phone
Free standard shipping (5-7 business days)
Express shipping(2-3 business days): $8.99
The next day shipping(1 business day): $12.99
Shippment Method
Next step
Payment Information
Edit
Use shipping address
First Name
Last Name
Address
City
Zip code
State
Phone
Pay by Credit Card
Card Number
Expiration
Zip code
CVV
Email Address
Sign up for discounts, new arrivals and packing tips
Or Pay by...
Next step
Order Review
Please review your order information and make any edits if necessary.
You will receive a conrmation email once your order has been placed.
Place Order
My Cart
Edit
Small Organize Bag
$68.00
Red
arrow_drop_down
| Qty 1
arrow_drop_down
Subtotal:
$68.00
Shipping:
free
Total:
$68.00


--- layout: post status: publish published: true title: Failed Message Routing author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 139 wordpress_url: http://winterdom.com/2005/07/failedmessagerouting date: '2005-07-19 13:11:03 +0000' date_gmt: '2005-07-19 13:11:03 +0000' categories: - BizTalk tags: [] comments: - id: 85 author: Linus Joseph author_email: '' author_url: http://blogs.covarius.com date: '2006-08-30 16:21:13 +0000' date_gmt: '2006-08-30 16:21:13 +0000' content: | One case where failed message routing doesnt seem to work is here.. http://blogs.covarius.com/PermaLink,guid,1cce4ee8-aa46-4eb6-9922-c2ed4cc728e8.aspx ---
As some people have mentioned recently, one of the new features in BizTalk Server 2006 (aka PathFinder) is routing of failed messages. This is a very cool new feature because it gives you the possibility of using the standard Pub/Sub mechanism exposed by BizTalk to handle failed messages (either because they failed during a receive or a send operation). The trick to enable this is the "Generate error report for failed message" checkbox in the port configuration.
One really nice thing about how this feature is implemented is that it should be adapter-agnostic, meaning it should work with any adapter that uses the standard adapter framework (except, I believe, MSMQT which it seems won't support it). Now, here's the tricky point: As I understood the feature, it would work with any adapter that supported suspending failed messages.
However, imagine my surprised when I noticed the feature working with a custom transactional receive adapter I had built for one of our customers, given that the adapter explicitly does not support message suspension (if the submit operation generates an error, the adapter just aborts the transaction and forgets about it).
In the case I was testing, I tried having the adapter submit a document with invalid XML to the XMLReceive pipeline (which would fail). Normally, I would've expected the adapter to trap the error and abort the transaction, but instead it went ahead and commited it! Apparently, when the "Generate error report for failed message" is enabled, the BizTalk messaging engine will trap the error condition when the message is submitted and, instead of reporting the error back to the adapter, it will tell it that everything went OK.
I do not know if this is intentional, or if it is a bug, but it certainly seems like an interesting behavior to be aware of. It would be interesting to know if this is not done for adapters that support in order processing... This was, btw, tested on the CTP of BizTalk 2006 given out at TechEd this year.


Return the number of the current HDU (CHDU) in the FITS file (where the primary array = 1), the name of the CHDU (if it is stored in the EXTNAME keyword), and the type of the CHDU in the FITS file.
|
error in (no error) error in describes error conditions that occur before this VI or function runs. |
|
status status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred. |
|
code code is the error or warning code. |
|
source source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. |
|
gfits refnum The file refnum associated with the file you want to access. |
|
error out error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. |
|
status status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred. |
|
code code is the error or warning code. |
|
source source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. |
|
dup gfits refnum Returns gfits refnum unchanged. |
|
hdu number Number of the current HDU. |
|
hdu name EXTNAME keyword value of the current HDU, if it exists. If it doesn't exist, this is an empty string. |
|
hdu type Type of the current HDU. The possible values are: 0: IMAGE_HDU 1: ASCII_TBL 2: BINARY_TBL |


INSTINCT RATING: 6.5 / 10 --> So-so
For more movie reviews and screensavers, visit http://www.joblo.com/
Seeing this movie's trailer, I wasn't sure whether this was a film about a man's love for monkeys, or an intense thriller pitting two of our best modern day actors against one another, a la THE NEGOTIATOR (7/10). It turned out to be a little bit of both, although the intensity of the thrills were at a much lower level than the man's love for his monkeys.
PLOT: A doctor who was lost in the African jungles for two years, and known to live side-by-side with gorillas, is found after he savagely murders two game wardens. Upon his return to the States, a young, career-minded psychiatrist is chosen to attempt to communicate with the man and understand his violent and anti-social behavior.
CRITIQUE: One part ONE FLEW OVER THE CUCKOO'S NEST (7/10), one part THE SHAWSHANK REDEMPTION (9/10) and one part GORILLAS IN THE MIST, one part SILENCE OF THE LAMBS (7.5/10), and one really big part TARZAN. This film offers very little in originality or thrills, but does manage to convey an effective loving relationship between the good doctor and the gorillas, and some superb acting on the part of the two lead actors. In fact, I think I would have been really bored were it not for the intense and believable portrayals of both characters. Anthony Hopkins plays an excellent doctor gone semi-loony who has us believing that a man of his intelligence could truly be taken in by a family of gorillas. Cuba Gooding's doctor Dooright character also meanders through every emotion flawlessly with all of his happiness, sadness, fear and cockiness creating a character to whom we can all relate and invest our emotion.
Were there enough twists in the plot? No, not at all. Pretty predictable.  Certainly not. But what this film does offer is a couple of great actors chewing down on some pretty tasty lines inside a plot which may resonate with some, in respect to its derogatory depiction of modern-day living, and society's over-emphasis on control, possessions, career and dominance. Now the lack of originality or action may have some of you returning to your ticket counter and demanding that they "Show you your money back!" (I'm sorry, but I just had to! :), but I quite enjoyed the performances in this film, and its oddly satisfying conclusion. Skip it if you're looking for an intense thriller or a sci-fi man-turns-into-a-gorilla vibe (ALTERED STATES (5/10) fans beware!), but check it out if you like either of the two leads or movies with monkeys in 'em!
Little Known Facts about this film and its stars: Anthony Hopkins' role was originally slated for Sean Connery.  Being British, Mr. Hopkins was glad to have conquered his alcoholism in 1975. He stands 5'7". Cuba Gooding Jr's first big-screen role came as the "boy getting haircut" in Eddie Murphy's 1988 hit COMING TO AMERICA (8/10). He reportedly received only $32,000 for his breakthrough role in 1991's BOYZ IN THE HOOD (8/10), while pocketing around $2.5 Million for his part in this one. He stands 5'10", and was born in The Bronx, New York. He also appeared in four episodes of TV's "MacGyver" from 1989 to 1991. Director Jon Turteltaub went from directing such films as 3 NINJAS and COOL RUNNINGS to 1995's WHILE YOU WERE SLEEPING and 1996's PHENOMENON. Believe it or not, the gorillas used in the film were not real. They all came from the wonderful world of Stan Winston's puppet Studio. This film was originally titled ISHMAEL, based on the novel of the same name by Daniel Quinn. The film credits this book as the piece from which its script was "suggested". Most of the jungle scenes were actually shot in Jamaica.
Review Date: May 29, 1999 Director: Jon Turteltaub Writer: Gerald DiPego Producer: Barbara Doyle and Michael Taylor Actors: Anthony Hopkins as Dr. Ethan Powell Cuba Gooding Jr. as Dr. Theo Caulder Genre: Thriller Year of Release: 1999 --------------------------------------- JoBlo's Movie Emporium http://www.joblo.com --------------------------------------- (c) 1999 Berge Garabedian
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


suspend fun getBalanceInfo(accountIndex: Int = 0): WalletBalance
Calculates the latest balance info. Defaults to the first account.
accountIndex
- the account to check for balance info.
Return
an instance of WalletBalance containing information about available and total funds.


{% extends "cosinnus/base.html" %} {% load i18n cosinnus_tags static ecobasa_tags ecobasa_time thumbnail %} {% load static from staticfiles %} {% block page_title %}{% if not group %}{{user.first_name|default:user.username }}{% else %}{{ group.name }}{% endif %} | ecobasa.org {% trans "Dashboard" %}{% endblock %} {% block extrahead %} {% endblock extrahead %} {% block content_title %}{% trans "Dashboard" %}{% endblock content_title %} {% block content %} {% get_current_language as LANGUAGE_CODE %}
{% trans "You did not enter your full name in your profile." %} {% trans "Add your full name here" %}
{% trans "This makes sense if you want to be found by people that know you to receive references. Also it helps to develop trust in this network and your person!" %}
{% trans "Now you can look for the"%} {% trans "location" %} {% trans "of other gift-economy pioneers around the world to connect with likeminded people in your area or while traveling. Do you want to share your location too?" %}
{% trans "You don't have a picture in your profile! It is much nice if people get a quick impression of how it looks like." %}
{% trans "You have to enter a location in your profile, otherwise your community will not show on our" %} {% trans "map" %}
{{ group.profile.public }}{% trans "You have to check public, so other users see your tour! If this is intentional, ignore this message." %}


Skorch works with almost any game!
More than just one game? Skorch supports tournaments too!
Skorch is built to be flexible for any type of game!
Skorch is free to use for any game or tournament!
Skorch supports Amazon Alexa too!
Skorch design & development downloads.


I am determined and hardworking and love a good challenge.
I am easily distracted and can be shy to people I don't know.
I think the strength that will help me the most is determination and tenacious because of how the Bootcamp is. There will be long hours and a lot of work to get done but I think I will be motivated enough to get through it.
At high school, I did have to work in groups and I did not always get to choose who was in my group because of this I did end up in groups with people who I did not like because of this it did affect my workflow. To combat this I did find out what I needed to do in the group and did get working and avoided him in the group and got stuck into my work. This has also happened when I worked at Pak'N'Save and there were some team members there that I did not get along with but and Pak'N'Save does put a lot of emphasis on teamwork among employees so I would ask to help someone else out instead of the person I was with, because of this I did get a lot more work done and it felt good.
I and my mum and sister were heading to the beach and stopped at Countdown on the way there so I could get some sausages and bread for a leaving work bbq and got my mum Whittaker's chocolate bar and my sister a bag of sour patch lollies. (I showed kindness by getting them a treat)
When I was working on a religious education assignment for school and someone did offer to type some up for me and I said I don't want them to because that would be plagiarism.
One of my friends left school and got mixed up with some bad influences and set her life off track and lost sight of her goals, so I did try to get her to get back on the path and when that didn't work I did distance myself from her so I would not get sucked into that lifestyle.
Trustworthy, Fun, Creative, Respectful, Honest, Versatile, Tenacious, Enthusiastic, Team player, Friendly
Procrastination, Shy, Overly self critical, Not assertive enough
Honesty, Trust, Humble, Respect, Kindness
Punctual, Good work ethic, Fast learner, Hard worker
Doesn't express ideas, Ya butt is da bomb


Smoothie world
Why Smoothies
Benefits
Recipes
My profile
Contact
John Smith
Follow
Yoga instructor
I like yoga and cooking healthy.
favorite
Favorites
comment
Comments
person
Following
Matcha Pear Green Protein Smoothie
Chocolate Banana Smoothie
Strawberry Ginger Smoothie
Razzy Blue Smoothie
Matcha Pear Green Protein Smoothie
"Nice smoothie"
Chocolate Banana Smoothie
"This one was not this good"
"Strawberry Ginger Smoothie"
"Cool smoothie"
John Smith
Eva Smith


Load Samples
{{ sample.title }}
Code
Graph
Reset
Place vertices
Draw edges
Mark initiators
Export
Copy and save the following:
Import
Paste graph:
Submit
Github
Reset
Run


Scatter plot between the two data variables are shown to find health risks facing particular demographics among United States. For this Analysis, 2014 data is grabbed from information from the U.S. Census Bureau and the Behavioral Risk Factor Surveillance System.
As expected poverty and lack of healthcare was directly related and householf income was indirectly related to lack of healthcare. Essentially, people who made less money and were not on nutrious diet were lacking healthcare. The trend is most likely from the annual fee for healthcare. Household with lower income most likely do not have enough money to support good healthcare for all household members.
Odd trend comes from obesity vs income. It's indirectly correlated, where less income had higher obesity rate. One reason I can deduce is that, lower income households are eating more less healthy food, i.e. fast food. Eating junk food at higher frequency would have caused weight to increase significantly.


Demo
Disable Adblock
Shows AdSense Ad loading on route change.
Sometimes a blank or identical AdSense ad is displayed.
- Page 1 - responsive ads
- Page 2 - ads with specified width
- Page 3 and 4 - same component but w/ setTimeout when the params are changed
to refresh the ads


Toggle navigation
Hybrid JS Debug
Gitlab
OpenUrl
Welcome
Query Executed
Query Not Executed
Open Url
inspect
ShowAlert
getNetworkType


DCC Auction (Ropsten Testnet)
Contract Address :
Account Address :
Holding ETH Count :
Holding Token Count :
iphone 7
Highest :
My bid :
Bid
Galaxy S9
Highest :
My bid :
Bid
iphone 8
Highest :
My bid :
Bid
Galaxy Note 9
Highest :
My bid :
Bid
iphone X
Highest :
My bid :
Bid
LG G7
Highest :
My bid :
Bid
Tokens
Tokens Info
Value
Price Per Token
Token Count In The Contract
Purchase Tokens
Buy


JavaScript is disabled on your browser.
Skip navigation links
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Prev
Next
Frames
No Frames
All Classes
Hierarchy For All Packages
Package Hierarchies:
alexatesting
,
dynamotesting
,
trashday
,
trashday.model
,
trashday.storage
,
trashday.ui
,
trashday.ui.requests
,
trashday.ui.responses
Class Hierarchy
java.lang.
Object
trashday.model.
CalendarEventTest
trashday.model.
CalendarTest
alexatesting.
DataAskResponseTest
alexatesting.
DataRequestTest
alexatesting.
DataTellResponseTest
trashday.ui.
DateTimeOutputUtilsTest
trashday.model.
DateTimeUtilsTest
trashday.storage.
DynamoAccessTestHelpers
trashday.storage.
LocalDynamoAccessTest
trashday.storage.
RemoteDynamoAccessTest
trashday.
TrashDaySpeechletRequestStreamHandlerTest
org.junit.rules.ExternalResource (implements org.junit.rules.TestRule)
dynamotesting.
LocalDynamoDBCreationRule
dynamotesting.
RemoteDynamoDBCreationRule
trashday.model.
IntentLogTest
trashday.model.
NextPickupsCalendarTest
trashday.model.
NextPickupsScheduleTest
trashday.model.
ScheduleTest
trashday.storage.
SessionDaoTest
trashday.ui.requests.
SlotDayOfMonthTest
trashday.ui.requests.
SlotDayOfWeekTest
trashday.ui.requests.
SlotNextOrThisTest
trashday.ui.requests.
SlotNthOfMonthTest
trashday.ui.requests.
SlotPickupNameTest
trashday.ui.requests.
SlotTimeOfDayTest
trashday.ui.requests.
SlotTimeZoneTest
trashday.ui.requests.
SlotWeekOfMonthTest
alexatesting.
TestDataAskResponse
alexatesting.
TestDataGeneralResponse
alexatesting.
TestDataRequest
alexatesting.
TestDataTellResponse
alexatesting.
TestDataUtterance
trashday.model.
TimeOfWeekTest
trashday.ui.responses.
VerbalUtilsTest
Skip navigation links
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Prev
Next
Frames
No Frames
All Classes
Copyright © 2017. All rights reserved.


Thank you for helping out!
The very short experiment will only take about 1-2 minutes. Your responses are voluntary for this part.
You will read a story about aliens from a different planet. The aliens have a different culture and a different language, so you may encounter words that you have never heard of in English -- but don't worry, because we are more interested in your reasoning.
If you are ready, click on the link below to begin.


| disipyl.mlabplots (version 1.2) | index /home/pmagwene/data/pmag/pyth/disipyl/mlabplots.py |
Presents a MATLAB like interface for plotting.
-----------------------------------------------------------------------------
(c) Copyright by Paul M. Magwene, 2002<EMAIL_ADDRESS>Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee or royalty is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation or portions thereof, including modifications,
that you make.
THE AUTHOR PAUL M. MAGWENE DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !
-----------------------------------------------------------------------------
| Modules | ||||||
|
| Functions | ||
|
| Data | ||
| __author__ = 'Paul M. Magwene __credits__ = '' __file__ = '/home/pmagwene/data/pmag/pyth/disipyl/mlabplots.py' __name__ = 'disipyl.mlabplots' __version__ = '$Revision: <IP_ADDRESS> $' |
| Author | ||
| Paul M. Magwene<EMAIL_ADDRESS>|
| Credits | ||


The Unmanned Aerial Vehicle Mission Planner provides an easy to use work flow for planning autonomous obstacle avoiding surveys of (almost) ready to fly unmanned aerial vehicles to retrieve aerial or spot related data. It creates either intermediate flight control files for the DJI phantom series or ready to upload control files for the pixhawk based flight controller as used in the 3DR Solo. Additionally it contains some useful tools for digitizing and data manipulation.
| Version: | 0.5.4 |
| Depends: | R (≥ 3.1.0) |
| Imports: | stringr, sp, raster, htmlwidgets, htmltools, rgdal, rgeos, gdalUtils, geosphere, tools, maptools, log4r, zoo, data.table, spatial.tools, devtools, sf, roxygen2, methods, brew |
| Suggests: | knitr, rmarkdown, mapview |
| Published: | 2018-10-28 |
| Author: | Chris Reudenbach [cre, aut], Sebastian Richter [ctb], Lars Opgenoorth [ctb], Florian Detsch [ctb], Hanna Meyer [ctb] |
| Maintainer: | Chris Reudenbach <reudenbach at uni-marburg.de> |
| BugReports: | https://github.com/gisma/uavRmp/issues |
| License: | GPL (≥ 3) | file LICENSE |
| URL: | https://github.com/gisma/uavRmp |
| NeedsCompilation: | no |
| SystemRequirements: | GNU make |
| Materials: | README NEWS |
| CRAN checks: | uavRmp results |
| Reference manual: | uavRmp.pdf |
| Vignettes: |
Unmanned Aerial Vehicle R based Mission Planning |
| Package source: | uavRmp_0.5.4.tar.gz |
| Windows binaries: | r-devel: uavRmp_0.5.4.zip, r-release: uavRmp_0.5.4.zip, r-oldrel: uavRmp_0.5.4.zip |
| OS X binaries: | r-release: uavRmp_0.5.4.tgz, r-oldrel: uavRmp_0.5.4.tgz |
| Old sources: | uavRmp archive |
Please use the canonical form https://CRAN.R-project.org/package=uavRmp to link to this page.


← Back to all examples.
Pass false as the second argument to the start and position methods to set the board position instantly.
false
start
position


Visit
Pet:
Name
Birth Date
Type
Owner
name
20000101
type
owner
Add Visit
Previous Visits:
Date
Description
description


Gateway
BOT
24-Jul-18 01:27 PM
[telegram] <Remul> I am holder from 3 and Kmd deserve it (re @Acura360: Again, what’s now your mission here ? ^^)
[telegram] <Remul> Coming time of real using??? no comments (re @BearTheTrader: KMD is not top marketed or top in lists, it is top notch tech, just it isn’t recognised for now and your comments are not helping just fudding and depreciating the facevalue but remember this: when the time of using the coins in real life will come like EOS we will see what happens because komodo is already working and many other features like smart contracts will come out, then what happens? the customers will want a working product, scalable, usable, not only promises and thin air like 99% of coins are.)
[telegram] <Dmanx> Fake news!  UK borders were protected by EU .. in france for example.
[telegram] <Dmanx> That whole family is corrupt
[telegram] <Matt> As i said.. power corrupts.. ofcourse she is not that clean.
We have to chose the less dangerous ones.. sadly enough
[telegram] <Dmanx> She's not that clean?
[telegram] <Matt> AND.. none of those politicians are going to change the course of how things will evolve and going to.
[telegram] <Dmanx> She murdered alot of people
[telegram] <Matt> Bigger agenda's decide..
[telegram] <Matt> And Trump didnt?
[telegram] <Matt> I bet he has dirty hands too :)
[telegram] <Dmanx> Yes maybe he paid for prostitutes, but so what
[telegram] <Matt> And what did this trump do in helsinki with putin?
[telegram] <Matt> If that was the only thing he did.. i could live with that
[telegram] <Matt> As long trump is president i will not visit the states.. wanted too but.. cant do it now..
[telegram] <Dmanx> What did he do?
[telegram] <Dmanx> Rape who
[telegram] <Matt> Weinstein in quadrant
[telegram] <Dmanx> So far he's doing everything he promised
[telegram] <Matt> Many woman who told what happened.. all not knowing eachother story.. same patterns allover.
From 40 years ago till few years ago.
[telegram] <Matt> Did the mexicans pay for the wall now?
[telegram] <Matt> No.. they never will
[telegram] <Dmanx> I don't like alot of thinks he does, but trust me he is wayyyyy better then her
[telegram] <Matt> Listen.. with his american first he means me and the lobbies i support first. Everyone else can go
[telegram] <Matt> Not nice
[telegram] <Dmanx> You wrong, both parties are working for lobbies
[telegram] <Matt> America should focus on internal infrastructure and health care first.
Indeed America first but on another level
[telegram] <Dmanx> That is wrong with this system
[telegram] <Matt> Power corrupts
[telegram] <Matt> We have to chose the least dangerous one
[telegram] <Dmanx> And that's what he's doing man
[telegram] <Maxi> It's a komodo Channel right?
[telegram] <Maxi> Stop spamming about politics
[telegram] <Dmanx> But obamacare is a mass
[telegram] <Dmanx> Better than that one guy spreading FUD (re @Maxi: Stop spamming about politics)
[telegram] <Maxi> And still not good
[telegram] <Matt> Yeah.. lets leave politics out of here.
Sorry about that.
[telegram] <Dmanx> At least something going on here, lol
[telegram] <Dmanx> Hey Matt, just so you know I'm not Trump supporter, I'm Rand Paul supporter


That makes it worth the journeying..."
The characters in the story are all rearing and ready to go! They need something to keep their spirits up, something to heighten the moment: A MUSICAL NUMBER! This is the number that everyone sings when they set off on their adventure. A "let's get ready and go" kind of number. Something jaunty and fun.
Often crosses over with the "I Want" Song. Compare Wanderlust Song.
Examples:
- "We're Off to See the Wizard" from The Wizard of Oz is probably the most famous example.
- "City of Light" from The Brave Little Toaster.
- "Adventuring" from The Land Before Time: The Great Longneck Migration.
- "Get Up and Go" from Little Golden Book Land.
- "Gonna Take You There" from The Princess and the Frog.
- "Never Say Never" from An American Tail, which doubles as a Pep-Talk Song.
- "Way Out West" from Fievel Goes West
- "The Apple Song" from Melody Time.
- "A Girl Worth Fighting For" from Mulan.
- "Hi-Diddle-Dee-Dee" from Pinocchio.
- "The Virginia Company" and its reprise from Pocahontas.
- "Movin' Right Along" from The Muppet Movie.
- "Sailing For Adventure" from Muppet Treasure Island.
- "Have You Been to Bahia?" from The Three Caballeros.
- The reprise of "When Will My Life Begin?" from Tangled.
- "Tomorrow Is Another Day", by Shelby Flint for The Rescuers.
- "(We're Off on the) Road to Morocco" from Road to Morocco.
- And the other Road to ... movies. They certainly do get around.
- Non-musical example: "The Submarine" from Atlantis: The Lost Empire, especially when we see the Ulysses finally descend into the ocean.
- "Summer Holiday" in Summer Holiday, which acts more as an unhelpful narrator than this trope, since it'd been established earlier (The song begins with "We're all going on a summer holiday..." yet it appears about ten minutes into the movie after the characters decide to do so).
- "A Whole Bunch Of World" from the film of Teacher's Pet
- Non-musical example: "Rescue" from the live-action 101 Dalmatians (1996). It's such a popular piece from the movie, that Disney re-used it for the VHS trailer of Sleeping Beauty and the theatrical trailer of Doug's 1st Movie
- While not a musical, Recess: School's Out used "Born To Be Wild" playing in the background as T.J. and Becky went to pick the gang up from their camps.
- "All Together Now" from Yellow Submarine.
- "I'm On My Way" by The Proclaimers from Shrek.
- "On My Way" by Phil Collins from Brother Bear
- "On the Trail We Blaze" from The Road to El Dorado.
- "The Song of the Marines" from The Singing Marine, a 1937 Warner Bros. film. But it's more well known from the Looney Tunes short "Conrad the Sailor".
- "Go the Distance" from Hercules starts off as an "I Want" Song before turning into this.
- "Journey to the Past" from Anastasia.
- "On the Open Road" from A Goofy Movie.
- "Second Star to the Right" and "Following the Leader" from Peter Pan.
- The Lord of the Rings has a few
- "The Road Goes Ever On," which also appears in the book.
- "A Walking Song," which appears in the book and is adapted as Pippin's song "The Edge of Night" in the movies. An unusual example in that it isn't sung while setting off, though by subject matter it is a setting-off song.
- "We're Off to See the World" from The Chipmunk Adventure.
- "How Far I'll Go" from Moana.
- "Goodbye Song" from Harriet is a rare Real Life example. Enslaved people about to run away from their captors often sang songs to their loved ones as a coded farewell, and the film uses the actual song that Harriet Tubman sang to her family.
- "New York, New York" from On the Town.
- "One Foot, Other Foot" from Allegro, sung by the Greek Chorus when Joseph Taylor, Jr. first learns to walk. It symbolizes adventurousness and determination, and becomes his personal motto.
- "I'm On My Way" from Paint Your Wagon introduces the various Forty Niners all bound for Rumson Creek.
- "A Weekend In The Country" from A Little Night Music.
- "Into The Woods" from Into the Woods.
- "Put On Your Sunday Clothes" from Hello, Dolly!.
- "There's A Hill Beyond A Hill" from Music in the Air.
- An unproduced musical version of The Man Who Fell to Earth from the Turn of the Millennium had one, "Icarus Descending", as its opening number.
- The title song of Merrily We Roll Along uses the life-as-road-trip metaphor.
- "Addison's Trip (I'm On My Way)" from Road Show.
- "Two By Two" for the missionaries in The Book of Mormon.
- "Strike That, Reverse It", which kicks off the second act of Charlie and the Chocolate Factory, is a highly comic version of this as Willy Wonka rushes through greeting each of the Golden Ticket finders and having their guardians sign a confusing contract, all so the tour can proceed on schedule. He's in such a hurry to set off that the tune is also a Patter Song.
- "Gotta Get Back to Hogwarts" from A Very Potter Musical.
- "Godspeed Titanic" from Titanic
- Both 'Climbing Song 1' and 'Climbing Song 2' from The Burnt Part Boys.
- 'Chop To The Top' and 'Hero Is My Middle Name' from The SpongeBob Musical.
- Crossing over with Grief Song, Stay, I Pray You from the broadway adaptation of Anastasia is about setting off, not on an adventure, but as refugees from a Soviet purge.
"Coachman, hold the horses
Let me say goodbye,
Stay, I pray you
Let me have a moment
Let me say goodbye
To bridge and river
Forest and waterfall
Orchard, sea, and sky
Harsh and sweet and bitter to leave it all
I'll bless my homeland till I die.''
- Wakko's Wish has "The Wishing Star", which is about the Warners leaving town to find the Wishing Star. Of course, their song causes the rest of Acme Falls to learn about the Star, provoking a race to claim the Wish.


Ships
{% for ship_type in ['Battleship', 'Battlecruiser', 'Cruiser', 'Destroyer', 'Frigate'] %}
{{ ship_type }}
{% for race in ['Amarr', 'Caldari', 'Gallente', 'Minmatar'] %}
{{ race }}
{{ skills['Spaceship Command'][race+' '+ship_type] }}
{% endfor %}
{% endfor %}
Advanced Ships
Marauders
{{ skills['Spaceship Command']['Marauders'] }}
Black Ops
{{ skills['Spaceship Command']['Black Ops'] }}
Command Ships
{{ skills['Spaceship Command']['Command Ships'] }}
Recon Ships
{{ skills['Spaceship Command']['Recon Ships'] }}
Heavy Assault Cruisers
{{ skills['Spaceship Command']['Heavy Assault Cruisers'] }}
Heavy Interdictor Cruisers
{{ skills['Spaceship Command']['Heavy Interdiction Cruisers'] }}
Logistics Cruisers
{{ skills['Spaceship Command']['Logistics Cruisers'] }}
{% for race in ['Amarr', 'Caldari', 'Gallente', 'Minmatar'] %}
{% if skills['Spaceship Command'][race+' Strategic Cruiser'] is defined %}
{{ race }} Strategic
{% else %}
{{ race }} Strategic
{% endif %}
{{ skills['Spaceship Command'][race+' Strategic Cruiser'] }}
{% endfor %}
Interdictors
{{ skills['Spaceship Command']['Interdictors'] }}
Command Destroyers
{{ skills['Spaceship Command']['Command Destroyers'] }}
Confessor
{{ skills['Spaceship Command']['Amarr Tactical Destroyer'] }}
Jackdaw
{{ skills['Spaceship Command']['Caldari Tactical Destroyer'] }}
Hecate
{{ skills['Spaceship Command']['Gallente Tactical Destroyer'] }}
Svipul
{{ skills['Spaceship Command']['Minmatar Tactical Destroyer'] }}
Interceptors {{ skills['Spaceship Command']['Interceptors'] }}
Assault Frigates {{ skills['Spaceship Command']['Assault Frigates'] }}
Covert Ops {{ skills['Spaceship Command']['Covert Ops'] }}
Electronic Attack Ships {{ skills['Spaceship Command']['Electronic Attack Ships'] }}
Logistics Frigates {{ skills['Spaceship Command']['Logistics Frigates'] }}


This page is used to test Cello Framwork
Textfield:
Textfield with id text1
Textfield with name text1
Simple Checkbox:
Checkbox with id check1
TextArea:
Textarea with id area1
Radio:
Selenium-Webdriver
Ruby
Cucumber
Watir-Webdriver
Link:
Link to other page
Link
Simple Select:
Select example
...
Cello
Cucumber
Ruby
Rspec
QA Rocks!


We're sorry but cattle-app doesn't work properly without JavaScript enabled. Please enable it to continue.


|
Name here
V1.0
Summary here
|
Public Member Functions | |
| void | Awake () |
| Subscribe the change animation function to the music start. More... | |
| void | KillParticles () |
| Stops particle production at end of prep beat More... | |
| void | AwakeParticles () |
| Starts particle production at beginning of prep beat More... | |
| void | ChangeAnimation () |
| Change animation to full gesture More... | |
| void | SetAnimationSpeed (float localBPM) |
| Set speed of the animation according to the localBPM in TempoController More... | |
| void | ToggleGestureActivation () |
Definition at line 5 of file ParticleBehaviour.cs.
| void ParticleBehaviour.Awake | ( | ) |
Subscribe the change animation function to the music start.
Definition at line 16 of file ParticleBehaviour.cs.
| void ParticleBehaviour.AwakeParticles | ( | ) |
Starts particle production at beginning of prep beat
Definition at line 33 of file ParticleBehaviour.cs.
| void ParticleBehaviour.ChangeAnimation | ( | ) |
Change animation to full gesture
Definition at line 41 of file ParticleBehaviour.cs.
| void ParticleBehaviour.KillParticles | ( | ) |
Stops particle production at end of prep beat
Definition at line 25 of file ParticleBehaviour.cs.
| void ParticleBehaviour.SetAnimationSpeed | ( | float | localBPM | ) |
Set speed of the animation according to the localBPM in TempoController
Definition at line 49 of file ParticleBehaviour.cs.
| void ParticleBehaviour.ToggleGestureActivation | ( | ) |
Definition at line 54 of file ParticleBehaviour.cs.


--- layout: post title: "DI-Friendly Framework" description: "How to create a Dependency Injection-friendly software framework." date: 2014-05-19 9:10 UTC tags: [Software Design, Dependency Injection] image: "/content/binary/framework-sequence-diagram.png" image_alt: "Framework sequence diagram" --- {% include JB/setup %}
{{ page.description }}
It seems to me that every time a development organisation wants to add 'Dependency Injection support' to a framework, all too often, the result is a Conforming Container. In this article I wish to describe good alternatives to this anti-pattern.
In a previous article I covered how to design a Dependency Injection-friendly library; in this article, I will deal with frameworks. The distinction I usually make is:
One of the most challenging aspects of writing a framework is that the framework designers can't predict what users will want to do. Often, a framework defines a way for you to interact with it:
Once the framework has an instance of the custom user class, it can easily start using it by invoking methods defined by the interface the class implements, etc. The difficult part is creating the instance. By default, most frameworks require that a custom class has a default (parameterless) constructor, but that may be a design smell, and doesn't fit with the Constructor Injection pattern. Such a requirement is a sensible default, but isn't Dependency Injection-friendly; in fact, it's an example of the Constrained Construction anti-pattern, which you can read about in my book.
Most framework designers realize this and resolve to add Dependency Injection support to the framework. Often, in the first few iterations, they get it right!
If you examine the sequence diagram above, you should realize one thing: the framework is the client of the custom user code; the custom user code provides the services for the framework. In most cases, the custom user code exposes itself as a service to the framework. Some examples may be in order:
There's an extremely important point hidden here: although it looks like a framework has to deal with the unknown, all the requirements of the framework are known:
"clients [...] own the abstract interfaces"This is a quote from chapter 11, which is about the Dependency Inversion Principle, so it all fits.
Notice what the framework does in the list above. Not only does it use the custom user objects, it also creates instances of the custom user classes. This is the tricky part, where many framework designers have a hard time seeing past the fact that the custom user code is unknown. However, from the perspective of the framework, the concrete type of a custom user class is irrelevant; it just needs to create an instance of it, but treat it as the well-known interface it implements.
public interface IFrameworkControllerFactory { IFrameworkController Create(Type controllerType); }
assuming that the interface that the user code must implement is called IFrameworkController.
The custom user class may contain one or more disposable objects, so in order to prevent resource leaks, the framework must also provide a hook for decommissioning:
public interface IFrameworkControllerFactory { IFrameworkController Create(Type controllerType); void Release(IFrameworkController controller); }
In this expanded iteration of the Abstract Factory, the contract is that the framework will invoke the Release method when it's finished with a particular IFrameworkController instance.
Some framework designers attempt to introduce a 'more sophisticated' lifetime model, but there's no reason for that. This Create/Release design is simple, easy to understand, works very well, and fits perfectly into the Register Resolve Release pattern, since it provides hooks for the Resolve and Release phases.
ASP.NET MVC 1 and 2 provided flawless examples of such Abstract Factories in the form of the IControllerFactory interface:
public interface IControllerFactory { IController CreateController( RequestContext requestContext, string controllerName); void ReleaseController(IController controller); }
Unfortunately, in ASP.NET MVC 3, a completely unrelated third method was added to that interface; it's still useful, but not as clean as before.
Framework designers ought to stop here. With such an Abstract Factory, they have perfect Dependency Injection support. If a user wants to hand-code the composition, he or she can implement the Abstract Factory interface. Here's an ASP.NET 1 example:
public class PoorMansCompositionRoot : DefaultControllerFactory { private readonly Dictionary<IController, IEnumerable<IDisposable>> disposables; private readonly object syncRoot; public PoorMansCompositionRoot() { this.syncRoot = new object(); this.disposables = new Dictionary<IController, IEnumerable<IDisposable>>(); } protected override IController GetControllerInstance( RequestContext requestContext, Type controllerType) { if (controllerType == typeof(HomeController)) { var connStr = ConfigurationManager .ConnectionStrings["postings"].ConnectionString; var ctx = new PostingContext(connStr); var sqlChannel = new SqlPostingChannel(ctx); var sqlReader = new SqlPostingReader(ctx); var validator = new DefaultPostingValidator(); var validatingChannel = new ValidatingPostingChannel( validator, sqlChannel); var controller = new HomeController(sqlReader, validatingChannel); lock (this.syncRoot) { this.disposables.Add(controller, new IDisposable[] { sqlChannel, sqlReader }); } return controller; } return base.GetControllerInstance(requestContext, controllerType); } public override void ReleaseController(IController controller) { lock (this.syncRoot) { foreach (var d in this.disposables[controller]) { d.Dispose(); } } } }
In this example, I derive from DefaultControllerFactory, which implements the IControllerFactory interface - it's a little bit easier than implementing the interface directly.
In this example, the Composition Root only handles a single user Controller type (HomeController), but I'm sure you can extrapolate from the example.
If a developer rather prefers using a DI Container, that's also perfectly possible with the Abstract Factory approach. Here's another ASP.NET 1 example, this time with Castle Windsor:
public class WindsorCompositionRoot : DefaultControllerFactory { private readonly IWindsorContainer container; public WindsorCompositionRoot(IWindsorContainer container) { if (container == null) { throw new ArgumentNullException("container"); } this.container = container; } protected override IController GetControllerInstance( RequestContext requestContext, Type controllerType) { return (IController)this.container.Resolve(controllerType); } public override void ReleaseController(IController controller) { this.container.Release(controller); } }
Notice how seamless the framework's Dependency Injection support is: the framework has no knowledge of Castle Windsor, and Castle Windsor has no knowledge of the framework. The small WindsorCompositionRoot class acts as an Adapter between the two.
If frameworks would only come with the appropriate hooks in the form of Abstract Factories with Release methods, they'd be perfect.
Unfortunately, as a framework becomes successful and grows, more and more types are added to it. Not only (say) Controllers, but Filters, Formatters, Handlers, and whatnot. A hypothetical XYZ framework would have to define Abstract Factories for each of these extensibility points:
public interface IXyzControllerFactory { IXyzController Create(Type controllerType); void Release(IXyzController controller); } public interface IXyzFilterFactory { IXyzFilter Create(Type fiterType); void Release(IXyzFilter filter); } // etc.
Clearly, that seems repetitive, so it's no wonder that framework designers look at that repetition and wonder if they can generalize. The appropriate responses to this urge, are, in prioritised order:
Many distinct, but similar Abstract Factory interfaces may be repetitive, but that's unlikely to hurt the user. A good framework provides optional extensibility points - it doesn't force users to relate to all of them at once. As an example, I'm a fairly satisfied user of the ASP.NET Web API, but while I create lots of Controllers, and the occasional Exception Filter, I've yet to write my first custom Formatter. I only add a custom IHttpControllerActivator for my Controllers. Although (unfortunately) ASP.NET Web API has had a Conforming Container in the form of the IDependencyResolver interface since version 1, I've never used it.
If the framework must address the apparent DRY violation of multiple similar Abstract Factory definitions, an acceptable solution is a generic interface:
public interface IFactory<T> { T Create(Type itemType); void Release(T item); }
This type of generic Factory is generally benign, although it may hurt discoverability, because a generic type looks as though you can use anything for the type argument T, where, in fact, the framework only needs a finite set of Abstract Factories, like
In the end, though, users will need to inform the framework about their custom factories, so this discoverability issue can be addressed. A framework usually defines an extensibility point where users can tell it about their custom extensions. An example of that is ASP.NET MVC's ControllerBuilder class. Although I'm not too happy about the use of a Singleton, it's hard to do something wrong:
var controllerFactory = new PoorMansCompositionRoot(); ControllerBuilder.Current.SetControllerFactory(controllerFactory);
Unfortunately, some frameworks attempt to generalize this extensibility point. As an example, in ASP.NET Web API, you'll have to use ServicesContainer.Replace:
public void Replace(Type serviceType, object service)
Although it's easy enough to use:
configuration.Services.Replace( typeof(IHttpControllerActivator), new CompositionRoot(this.eventStore, this.eventStream, this.imageStore));
It's not particularly discoverable, because you'll have to resort to the documentation, or trawl through the (fortunately open source) code base, in order to discover that there's an IHttpControllerActivator interface you'd like to replace. The Replace method gives the impression that you can replace any Type, but in practice, it only makes sense to replace a few well-known interfaces, like IHttpControllerActivator.
Even with a generic Abstract Factory, a much more discoverable option would be to expose all extensible services as strongly-typed members of a configuration object. As an example, the hypothetical XYZ framework could define its configuration API like this:
public class XyzConfiguration { public IFactory<IXyzController> ControllerFactory { get; set; } public IFactory<IXyzFilter> FilterFactory { get; set; } // etc.  Additionally, it's easy to enumerate all extensibility options, because the XyzConfiguration class provides a one-stop place for all extensibility points in the framework.
Some frameworks provide extensibility points in the form of attributes. ASP.NET MVC, for example, defines various Filter attributes, such as [Authorize], [HandleError], [OutputCache], etc. Some of these attributes contain behaviour, because they implement interfaces such as IAuthorizationFilter, IExceptionFilter, and so on.
Attributes with behaviour is a bad idea. Due to compiler limitations (at least in both C# and F#), you can only provide constants and literals to an attribute. That effectively rules out Dependency Injection, but if an attribute contains behaviour, it's guaranteed that some user comes by and wants to add some custom behaviour in an attribute. The only way to add 'Dependency Injection support' to attributes is through a static Service Locator - an exceptionally toxic design. Attribute designers should avoid this. This is not Dependency Injection support; it's Service Locator support. There's no reason to bake in Service Locator support in a framework. People who deliberately want to hurt themselves can always add a static Service Locator by themselves.
Instead, attributes should be designed without behaviour. Instead of putting the behaviour in the attribute itself, a custom attribute should only provide metadata - after all, that's the original raison d'être of attributes.
Attributes with metadata can then be detected and handled by normal services, which enable normal Dependency Injection. See this Stack Overflow answer for an ASP.NET MVC example, or my article on Passive Attributes for a Web API example.
A framework must expose appropriate extensibility points in order to be useful. The best way to support Dependency Injection is to provide an Abstract Factory with a corresponding Release method for each custom type users are expected to create. This is the simplest solution. It's extremely versatile. It has few moving parts. It's easy to understand. It enables gradual customisation.
Framework users who don't care about Dependency Injection at all can simply ignore the whole issue and use the framework with its default services. Framework users who prefer to hand-code object composition, can implement the appropriate Abstract Factories by writing custom code. Framework users who prefer to use their DI Container of choice can implement the appropriate Abstract Factories as Adapters over the container.
That's all. There's no reason to make it more complicated than that. There's particularly no reason to force a Conforming Container upon the users.
Comments
1. A framework generally must have some sort of initializer, particularly if it must do something like add route values to MVC (which must be done during a particular point in the application lifecycle). This startup code must be placed in the composition root of the application. Considering that the framework should have no knowledge of the composition root of the application, how best can this requirement be met? The only thing I have come up with is to add a static method that must be in the application startup code and using WebActivator to get it running.
2. Sort of related to the first issue, how would it be possible to address the extension point where abstract factories can be injected without providing a static method? I am considering expanding the static method from #1 to include an overload that accepts an Action<IConfiguration> as a parameter. The developer can then use that overload to create a method Configure(IConfiguration configuration) in their application to set the various abstract factory (in the IConfiguration instance, of course). The IConfiguration interface would contain well named members to set specific factories, so it is easy to discover what factory types can be provided. Could this idea be improved upon?
3. Considering that my framework relies on the .NET garbage collector to dispose of objects that were created by a given abstract factory, what pattern can I adapt to ensure the framework always calls Release() at the right time? A concrete example would seem to be in order.
Shad, thank you for writing. From your questions it's a bit unclear to me whether you're writing a framework or a library. Although you write framework, your questions sound like it's a library... or at least, if you're writing a framework, it sounds like you're writing a sub-framework for another framework (MVC). Is that correct?
Re: 1. It's true that a framework needs some sort of initializer. In the ideal world, it would look something like
new MyFrameworkRunner().Run();
, and you would put this single line of code in the entry point of your application (its Main method). Unfortunately, ASP.NET doesn't work that way, so we have to work with the cards we're dealt. Here, the entry point is Application_Start, so if you need to initialise something, this is where you do it.The initialisation method can be a static or instance method.
Re: 2. That sounds reasonable, but it depends upon where your framework stores the custom configuration. If you add a method overload to a static method, it almost indicates to me that the framework's configuration is stored in shared state, which is never attractive. An alternative is to utilise the Dependency Inversion Principle, and instead inject any custom configuration into the root of the framework itself:
new MyFrameworkRunner(someCustomCoonfiguration).Run();
Re: 3. A framework is responsible for the lifetime of the objects it creates. If it creates objects, it must also provide an extensibility point for decommissioning them after use. This is the reason I strongly recommend (in this very article) that an Abstract Factory for a framework must always have a Release method in addition to the Create method.
A concrete example is difficult to provide when the question is abstract...
If you want to take a look, the framework I am referring to is called MvcSiteMapProvider. I would definitely categorize it as a sub-framework of MVC because it can rely on the host application to provide service instances (although it doesn't have to). It has a static entry point to launch it's composition root (primarily because WebActivator requires there to be a static method, and WebActivator can launch the application without the need for the NuGet package to modify the Global.asax file directly), but the inner workings rely (almost) entirely on instances and constructor injection. There is still some refactoring to be done on the HTML helpers to put all of the logic into replaceable instances, which I plan to do in a future major version.
Since it is about 90% of the way there already, my plan is to modify the internal poor-man's DI container to accept injected factory instances to provide the alternate implementations. A set of default factories will be created during initialization, and then it will pass these instances (through the IConfiguration variable) out to the host application where it can replace or wrap the factories. After the host does what it needs to, the services will be wired up in the poor man's DI container and then its off to the races. I think this can be done without dropping support for the existing Conforming Container, meaning I don't need to wait for a major release to implement it.
Anyway, you have adequately answered my 2 questions about initialization and I think I am now on the right track. You also gave me some food for thought as how to accomplish this without making it static (although ultimately some wrapper method will need to be static in order to make it work with WebActivator).
As for my 3rd question, you didn't provide a sufficient answer. However, I took a peek at the MVC source code to see how the default IControllerFactory ReleaseController() method was implemented, and it is similar to your PoorMansCompositionRoot example above (sort of). They just check to see if IController will cast to IDisposable and call Dispose() if it does. I guess that was the general pattern I was asking for, and from your example it looks like you are in agreement with Microsoft on the approach.
Shad, I don't exactly recall how DefaultControllerFactory.ReleaseController is implemented, but in general, only type-checking for IDisposable and calling Dispose may be too simplistic a view to take in the general case. As I explain in chapter 8 in my book, releasing an object graph isn't always equivalent to disposal. In the general case, you also need to take into account the extra dimension of the various lifetimes of objects in an object graph. Some object may have a longer lifetime scope, so even when you invoke Release on them, their time isn't up yet, and therefore it would be a bug to dispose of them.
This is one of the reasons a properly design Abstract Factory interface (for use with .NET) must have a Release method paired with its Create method. Only the factory knows if it actually created an object (as opposed to reused an existing object), so only the factory knows when it's appropriate to dispose of it again.
Dear Mark,
Concering the the type of generic IFactory, I think that aplying a Marker Interface for T whould make the implementation very discoverable and also type-safe.
What is your opinion about it?
Robert, thank you for writing. What advantage would a Marker Interface provide?
1. From framework perspective - less code. 2. From client perspective - more consistent API. We can see all the possible hooks just by investigating which interfaces of the Framwork implements the marker interface - even the IntelliSence would show the possibilities of the factories which can be implemented. As I write the comment, I see also some drawbacks - the IFactory should generally not work with generic which is the marker interface itself and also for some client interfaces that would implement the marker interface. However still I find it much better ans safer than just having a generic IFactory without ANY constraints.
Additionally maybe you could also enchance this post with information how to Bootstrap the framwork? For example I extremely like thecodejunkie's way which he presented on his Guerilla Framework Design presentation.
Or also maybe you could give some examples how could the framework developers use the container? Personally the only way I see that it could be done is to use some "embedded" container like TinyIoC. This is the way how Nancy is done.
How does a Marker Interface lead to less framework code? It has no behaviour, so it's hard for me to imagine how it leads to less code. From a client perspective, it also sounds rather redundant to me. How can we see the possible hooks in the framework by looking for a Marker Interface? Aren't all public interfaces defined by a framework hooks?
What do you mean: "how could the framework developers use the container"? Which container? The whole point of this very post is to explain to programmers how to design a DI Friendly framework without relying on a container - any container.
Hi Mark, thank you for this very helpful blog post. I still have two questions though:
bitbonk, thank you for writing.
Re 1: A framework can compose any default complex object graph it wants to. If a framework developer is worried about performance, he or she can always make the default configuration a lazily initialized Singleton:
Since the default value is only initialized if it's used, there's no cost associated with it. The XyzConfiguration class still has a public constructor, so if a framework user doesn't want to use the default, he or she can always create a new instance of the class, and pass that configuration to the framework when it's bootstrapping. The user can even use XyzConfiguration.Default as a starting point, and only tweak the properties he or she wants to tweak.
While XyzConfiguration.Default defines default graphs, all the constituent elements (XyzControllerFactory, Foo, Bar, Baz, etc.) are public classes with public constructors, so a framework user can always duplicate the graph him- or herself. If the framework developers want to make it easier to tweak the default graph, they can supply a facade using one of the options outlines in my companion article about DI-friendly libraries.
Re 2: Such an XyzConfiguration class isn't a Service Locator. It's a concrete, well-known, finite collection of Abstract Factories, whereas a Service Locator is an unknown, infinite set of Abstract Factories.
Still, I would recommend that framework developers adhere to the Interface Segregation Principle and only take dependencies on those Abstract Factories they need. If a framework feature needs an IFactory<IXyzController>, then that's what it should take in via its constructor. The framework should pass to that constructor
configuration.ControllerFactory
instead of the entireconfiguration
object.Thanks Mark for your answer, it all makes sense to me but my first question was more geared towards the DI container. For the composition of the default dependency graphs, the (my) framework needs to provide three things at the same time:
I find it particularly challenging to come up with a good design that meets all three of these requirements. I don't really have a question for you here, because the answer will most likely have to be: "it depends". But feel free to comment, if you have any additional thoughts that are worth sharing.
Before we continue this discussion, I find myself obliged to point out that you ought have a compelling reason to create a framework. Tomas Petricek has a great article that explains why you should favour libraries over frameworks. The article uses F# for code examples, but the arguments apply equally to C# and Object-Oriented Design.
I have a hard time coming up with a single use case where a framework would be the correct design decision, but perhaps your use case is a genuine case for making a framework...
That said, I don't understand your second bullet point. If all the classes involved in building those default object graphs are public, a user can always register them with their DI Container of choice. Why would you need a container abstraction (which is a poor idea) for that?
The third bullet point makes me uneasy as well. It seems to me that the entire premise in this, and your previous, comment is that the default object graphs are deep and complex. Is that really necessary?
Still, if you want to make it easy for a user to modify the default factories, you can supply a Facade or Fluent Builder as already outlined. The user can use that API to tweak the defaults. Why would the user even wish to involve a DI Container in that process?
For the sake of argument, let's assume that this is somehow necessary. The user can still hook into the provided API and combine that with a DI Container. Here's a Castle Windsor example:
This utilises the API provided by the framework, but still enables you to resolve a custom IBar instance with the DI Container. All other objects built by XyzControllerFactoryBuilder are still handled by that Fluent Builder.
I like to respond to bitbonk's comment where he states that "this could be achieved by introducing some sort of framework-specific DI container abstraction" where he mentions that NancyFx takes this approach.
It is important to note that NancyFx does not contain an adapter for Simple Injector and it has proven to be impossible to create an adapter for NancyFx's Conforming Container. The Conforming Container always expects certain behavior of the underlying container, and there will always be at least one container that fails to comply to this contract. In the case of NancyFx, it is Simple Injector. This is proof that the Conforming Container is an anti-pattern.
Besides the Conforming Container design, Nancy does however contain the right abstractions to intercept the creation of Nancy's root types (modules). This has actually made it very straightforward to plugin Simple Injector into NancyFx. It's just a matter of implementing a custom
INancyModuleCatalog
and optionally anINancyContextFactory
.Although we might think that the Conforming Container and having proper abstractions can live side-by-side, there is a serious downside. In the case of NancyFx for instance, the designers were so focussed on their Conforming Container design, that they had a hard time imagining that anyone would want to do without it. This lead to the situation that they themselves didn't even realize that a container could actually be plugged-in without the use of the Conforming Container. This caused me figure this out by myself.
So the risk is that the focus on the Conforming Container causes the designers of the framework to forget about developers that can't comply with their Conforming Container abstraction. This makes working without such adapter an afterthought to the designers. We are seeing this exact thing happening within Microsoft with their new .NET Core framework. Although at the moment of writting (which is 6 months after .NET Core has been released) only one of the leading DI containers has official support for the .NET Core Conforming Container, Microsoft makes little efforts in trying to improve the situation for the rest of the world, because, as the lead architect behind their Conforming Container quite accurately described it himself: "it's just my bias towards conforming containers clouding my vision".
Dear Mark, all,
I would appreciate some advice. Thanks in advance.
I am refactoring a small real-time graphics framework, and am unsure the best way to structure the code at the top level.
I doubt I have described things very well, but fingers crossed...
I provide a bit of background on how I got to this point, but ultimately my question is one about where exact a framework's own internal wiring happens, particularly the registering or creation of internal components that the USER should not have knowledge of.
Framework or Library?:
The first advice I read was actually to avoid using a FRAMEWORK structure where possible. However, although it is not of sufficient breadth to describe my code as an "Engine", it needs to control the looping of the application (and entire lifetime). I do NOT deem it realistic to refactor into a LIBRARY. I particularly do not believe the "solution" to structuring the update() part of a game engine, as described here, is simple to use or elegant.
Article Advocating Libraries over Frameworks
Therefore, I decided to stick with the FRAMEWORK approach.
Framework Aims:
The Framework Accepts (or will Create, as per your recommendation) an object implementating IApplication
The Framework calls methods in IApplication such as Load(), Update(), Draw()
The Framework provides Functions to the Application via a number of interfaces: IGraphics, IInput etc
The Framework should follow DI principles to ease Testing
The USER should NOT be required to wire-up the internal components of the framework.
The API / Interface usage be simple for the USER: i.e. Framework.Run(Application);
The API should be clean - i.e. I would prefer if the USER were unable to see / instantiate internal framework objects (i.e. preference is for INTERNAL rather than PUBLIC preference)
I would like to use an IOC container
My Initial Approach:
My approach before finding this article was therefore to have something like:
Assembly0: Application
Assembly1: Contains Interfaces, & Framework incl. a Static Loader Method
Assembly2: Framework Tests
The application would create IApplication interface, and feed it via the Static Loader Method into Assembly1
In Assembly1 (the framework), there would be a framework composition root that would spool up the engine, either by using an IOC container and registering components, or manual DI
Problems Encountered First, in relation to testing (how I got to the issue, rather than the issuer itself):
It was at this point, whilst trying to ensure the API was clean, that I realised I was unable to use INTERNAL only classes and still test them without add "Internals Visible Attribute". This felt a bit dirty (BUT might be the right solution). I thought I could pull out the interface to another third assembly, but given the references needed i always ended up being visible to the user. Anyway, that's besides the point slightly...
It was at this point I started to look for some advice on how to structure a framework, and I ran across this article...
So it became clear that I should make the Framework Create the Application via a Factory... which OK is fine
but i get stuck when trying to figure out how to adhere too - DI containers / composition roots should only exist in the application. There should only be one container / composition root. It should not live in the framework
Where i am now stuck:
I don't have any clue how the approach presented in your article solves the internal setup and wiring of the framework itself?
I do not see how I can rely on the FRAMEWORK USER to choose either simple DI or using an IOC container, without them needing to know how to wire up different components inside my framework. This does NOT seem EASY to me. Should the user really have to register things like the Graphics Implementation against the IGraphics interface, etc?
Is it really that bad to use two IOCs? One only internal to the framework itself, used in a static set up method? Am I missing something obvious about how I should structure my code?
It seems one option (at least on the Library-form side) is to use a facade that offers default wiring options. I assume this sits in the framework assembly, containers a factory method, and is OK to use a DI container within? I am then unsure exactly how that would pair with the abstract factories in this advice that create the applications.
Perhaps there is a good example of a framework (or trivial example) that can be pointed too?
Thanks again. I assume there is no perfect solution but appreciate your advice.
Dear Mark,
My apologies for the somewhat rambled query above.
I believe it might be more simple if I show you my simplified version of a proposed structure for a framework, that takes a user defined application.
Repo With Simple Framework Example
The Assemblies involved are (named more simply in the repo):
UserApplication
ApiInterface
Framework
FrameworkTesting
I would be very interested to know if you see this framework structure as misguided or plain smelly.
I am finding this topic quite interesting, and would be facinated to see an improved approach.
If it turns out not to stink too badly, I will press on and use this structure
I have read your DI book (potentially missing some key points given I am asking these questions...), and so would really appreciate and respect your opinion.
This structure features:
- A user created application object inheriting the application interface
- A static method in a Facade class to help wire up the framework (is a static compoisiton route that could include an IoC container)
- Allows application -side composition root by user NOT using the Facade helper
- A somewhat 'clean' public interface / API whereby internal framework components are atleast deeper in the namespace tree
- Full testability of internal components and external services
- Constructor injection to achieve DI
How this structure breaks advice:
- Using the Helper Facade could result in any IoC container not being in only composition route (and perhaps the application employs another container)
- The Framework does not instantiate the Custom Application Objects
For the latter, I am unsure how to create something Framework Side that is a factory to create a custom user class without referencing the application namespace and adding bi-drectional dependency on App -> Framework
I am sure I am missing some obvious stuff.
Thanks again
John
John, thank you for writing. When I look at your GitHub repository, I think that it looks fine. I particularly like that if I had to work with something like this, I get to control the lifetime of all my object graphs. I just have to implement
IApp
and callCompositionFacade.Run
with it.This makes it more like a library than a framework, although I do understand that the intent is that
Run
executes for the lifetime of the application.This means that if I need to implement
IApp
with a complex graph of objects, I can do that. In myMain
method, I can compose my object graph with Pure DI, or I can leverage a DI Container if I so choose.What happens inside of
CompositionFacade.Run
is completely opaque to me, which implies good encapsulation.I do, however, consider a separate
interface
library redundant. What purpose does it serve?


I'm Dusty Walker, I'm a 21 year old man, and my family is my Mom and my 2 cats.
I live in Tompkinsville, Kentucky.
I like cats
I'm in love with Legend of Zelda Breath of the Wild
I love Anime


{%- comment -%} Use {%- include tags/descriptions.html -%} for an HTML description list showing all tags. For each tag (used and/or having a tag-page) the description term is a link to the page where the tag uses are listed. The description shows how many times the tag is used; for tags with tag-pages, it also shows the description field set in its front matter, if any. {%- endcomment -%} {%- include tags/site_tag_slugs.html %} {%- include tags/site_tags.html -%} {%- include tags/site_tag_page.html %} {%- assign site_slugs = site_tag_slugs | concat: site_tag_page_slugs | uniq | sort -%}
Used tags: {{ used }} of {{ site_slugs.size }}


Parents: Teenage Daughters Forced to Marry at Gunpoint
A Baghlan family claims their daughters were forced to marry into a strongman’s family.
by Anisa ShaheedParents claim that their two daughters—aged 13 and 17--were forced to marry men from a strongman’s family in the northern province of Baghlan. The parents claim they have attempted to get justice many times but have not succeeded.
The parents, who are in Kabul seeking justice, said a member of the strongman’s family forcibly married their 17-year-old daughter this year. But after one week, the strongman’s family claimed that the girl was “not a virgin” and the girl’s family should give their younger daughter in exchange for her older sister. The parents said they were threatened by the strongman’s family to agree to give their 13-year-old to another man from the strongman’s family.
The elder daughter said she was forced to admit that she was not a virgin.
“I was threatened to accept the accusation (of not being a virgin) otherwise they would kill me,” said Soidad, the 17-year-old girl. “The boy was crazy and when I raised my voice, I was threatened to stay silent.”
The parents said they lodged many complaints to the court and security organizations in Baghlan, but their voice was not heard.
“The strongman’s family asked me: ‘Why you are staying silent? Give us your next daughter as an exchange and get your (17-year-old) daughter back. I told them that I cannot do that,” said Suraya, the mother of the two girls.
But then the strongman took her 13-year-old daughter at midnight and forced her to marry his son, according to the parents.
“They forcibly took my daughter. My daughter was crying. They took her at gunpoint and married her by force. The imam was not ready to do the nikah for my daughter, but they forced him to do so,” Suraya explained.
The parents also claimed that the strongman is supported by Azim Mohseni, an MP from Baghlan.
“These criminals said they have an elder and ‘if you raise your voice each one of you will be imprisoned for twenty to thirty years,’” said Ghulam Qadir, father of the girls.
Mohseni, meanwhile, rejected the allegations.
“I am not aware of the issue. Both sides are like family to me and I do not have armed men,” Mohseni said.


Tutorial : Salience Maps for Text
Or, run your own with examples/glue_demo.py
LIT enables users to analyze individual predictions for text input using salience maps, for which gradient-based and/or blackbox methods are available. In this tutorial, we will explore how to use salience maps to analyze a text classifier in the Classification and Regression models demo from the LIT website, and how these findings can support counterfactual analysis using LIT’s generators, such as Hotflip, to test hypotheses. The Salience Maps module can be found under the Explanations tab in the bottom half of this demo and it supports four different methods for the GLUE model under test (with other models it might support a different number of these methods) - Grad L2 Norm, Grad · Input, Integrated Gradients (IG) and LIME.
Heuristics : Which salience method for which task?
Salience methods are imperfect. Research has shown that salience methods are often “sensitive to factors that do not contribute to a model’s prediction”; that people tend to overly trust salience values or use methods they believe they know incorrectly; and that model architecture may directly impact the utility of different salience methods.
With those limitations in mind, the question remains as to which methods should be used and when. To offer some guidance, we have come up with the following decision aid that provides some ideas about which salience method(s) might be appropriate.
If your model does not output gradients with its predictions (i.e., is a blackbox), LIME is your only choice as it is currently the only black-box method LIT supports for text data.
If your model does output gradients, then you can choose among three methods: Grad L2 Norm, Grad · Input, and Integrated Gradients (IG). Grad L2 Norm and Grad · Input are easy to use and fast to compute, but can suffer from gradient saturation. IG addresses the gradient saturation issue in the Grad methods (described in detail below), but requires that the model output both gradients and embeddings, is much more expensive to compute, and requires parameterization to optimize results.
Remember that a good investigative process will check for commonalities and patterns across salience values from multiple salience methods. Further, salience methods should be an entry point for developing hypotheses about your model’s behavior, and for identifying subsets of examples and/or creating counterfactual examples that test those hypotheses.
Salience Maps for Text : Theoretical background and LIT overview
All methods calculate salience, but there are subtle differences in their approaches towards calculating a salience score for each token. Grad L2 Norm only produces absolute salience scores while other methods like Grad · Input (and also Integrated Gradients and LIME) produce signed values, leading to an improved interpretation of whether a token has positive or negative influence on the prediction.
LIT uses different color scales to represent signed and unsigned salience scores. Methods that produce unsigned salience values, such as Grad L2 Norm, use a purple scale where darker colors indicate greater salience, whereas the other methods use a red-to-green scale, with red denoting negative scores and green denoting positive.
Token-Based Methods
Gradient saturation is a potential problem for all of the Gradient based methods, such as Grad L2 Norm and Grad · Input, that we need to look out for. Essentially if the model learning saturates for a particular token, then its gradient goes to zero and appears to have zero salience. At the same time, some tokens actually have a zero salience score, because they do not affect the predictions. And there is no simple way to tell if a token that we are interested in is legitimately irrelevant or if we are just observing the effects of gradient saturation.
The integrated gradients method addresses the gradient saturation problem by enriching gradients with embeddings. Tokens are the discrete building blocks of text sequences, but they can also be represented as vectors in a continuous embedding space. IG computes per-token salience as the average salience over a set of local gradients computed by interpolating between the token’s embedding vectors and a baseline (typically the zero vector). The tradeoff is that IG requires more effort to identify the right number of interpolation steps to be effective (configurable in LIT’s interface), with the number of steps correlating directly with runtime. It also requires more information, which the model may or may not be able to provide.
Blackbox Methods
Some models do not provide tokens or token-level gradients, effectively making them blackboxes. LIME can be used with these models. LIME works by generating a set of perturbed inputs, generally, by dropping out or masking tokens, and training a local linear model to reconstruct the original model's predictions. The weights of this linear model are treated as the salience values.
LIME has two limitations, compared to gradient-based methods:
- it can be slow as it requires many evaluations of the model, and
- it can be noisy on longer inputs where there are more tokens to ablate.
We can increase the number of samples to be used for LIME within LIT to counter the potential noisiness, however this is at the cost of computation time.
Another interesting difference between the gradient based methods and LIME lies in how they analyze the input. The gradient based methods use the model’s tokenizer, which splits up words into smaller constituents, whereas LIME splits the text into words at whitespaces. Thus, LIME’s word-level results are often incomparable with the token-level results from other methods, as you can see in the salience maps below.
Single example use-case : Interpreting the salience maps module
Let’s take a concrete example and walkthrough how we might use the salience maps
module and counterfactual generators to analyze the behavior of the sst2-tiny
model on the classification task.
First, let’s refer back to our heuristic for choosing appropriate methods.
Because sst2-tiny
does not have a LSTM architecture, we shouldn't rely too
much on Grad · Input. So, we are left with Grad L2 Norm, Integrated Gradients
and LIME to base our decisions on.
To gain some confidence in our heuristic, we look for examples where Grad · Input performs poorly compared to the other methods. There are quite a few in the dataset, for example the sentence below where Grad · Input predicts completely opposite salience scores to its counterparts.
Use Case 1: Sexism Analysis with Counterfactuals
Coming back to our use-case, we want to investigate if the model displays sexist behavior for a particular input sentence. We take a datapoint with a negative sentiment label, which talks about the performance of an actress in the movie.
The key words/tokens (based on salience scores across the three chosen methods) in this sentence are “hampered”, “lifetime-channel”, “lead”, “actress”, “her” and “depth”. The only words out of this which are related to gender are “actress” and “her”. The words “actress” and “her” get a significant weight for both Grad L2 Norm and IG, and is assigned a positive score (IG scores are slightly stronger than Grad L2 Norm scores), indicating that the gender of the person is helping the model be sure of its predictions of this sentence being a negative review sentiment. However for LIME, the salience scores for these two words is a small negative number, indicating that the gender of the model is actually causing a small decrease in model confidence for the prediction of this being a negative review. Even with this small disparity between the token-based and blackbox methods in the gender related words in the sentence, it turns out that these are not the most important words. “Hampered”, “lifetime-channel” and “plot” are the dominating words/tokens for this particular example in helping the model make its decision. We still want to explore if reversing the gender might change this. Would it make the model give more or less importance to other tokens or the tokens we replaced? Would it change the model prediction confidence scores?
To do this, we generate a counterfactual example using the Datapoint Editor which is located right beside the Data Table in the UI, changing "actress" with "actor" and "her" with "his" after selecting our datapoint of interest. An alternative to this approach is to use the Word replacer under the Counterfactuals tab in the bottom half of the LIT app to achieve the same task. If our model is predicting a negative sentiment due to sexist influences towards “actress” or “her”, then the hypothesis is that it should show opposite sentiments if we flip those key tokens.
However, it turns out that there is very minimal (and hence negligible) change in the salience score values of any of the tokens. The model doesn't change its prediction either. It still predicts this to be a negative review sentiment with approximately the same prediction confidence. This indicates that at least for this particular example, our model isn’t displaying sexist behavior and is actually making its prediction based on key tokens in the sentence which are not related to the gender of the actress/actor.
Use Case 2: Pairwise Comparisons
Let’s take another example. This time we consider the sentence “a sometimes tedious film” and generate three counterfactuals, first by replacing the two words “sometimes” and “tedious” with their respective antonyms one-by-one and then together to observe the changes in predictions and salience.
To create the counterfactuals, we can simply use the Datapoint Editor which is
located right beside the Data Table in the UI. We can just select our data point
of interest (data point 6), and then replace the words we are interested in with
the respective substitutes. Then we assign a label
to the newly created
sentence and add it to our data. For this particular example, we are assigning 0
when "tedious" appears and 1 when "exciting" appears in the sentence. An
alternative to this approach is to use the Word replacer under the
Counterfactuals tab in the bottom half of the LIT app to achieve the same task.
We can pin the original sentence in the data table and then cycle through the three available pairs by selecting each of the new sentences as our primary selection. This will give us a comparison-type output in the Salience Maps module between the pinned and the selected examples.
When we replace “sometimes” with “often”, it gets a negative score of almost equal magnitude (reversing polarity) from LIME which makes sense, because “often” makes the next word in the sentence more impactful, linguistically. The model prediction doesn’t change either, and this new review is still classified as having a negative sentiment.
On replacing “tedious” with “exciting”, the salience for “sometimes” changes from positive score to negative in the LIME output. In the IG output, “sometimes” changes from a strong positive score to a weak positive score. These changes are also justified because in this new sentence “sometimes” counters the positive effect of the word “exciting”. The main negative word in our original datapoint was “tedious” and by replacing this with a positive word “exciting”, the model’s classification of this new sentence also changes and the new sentence is classified as positive with a very high confidence score.
And finally, when we replace both “sometimes tedious” with “often exciting”, we get strong positive scores from both LIME and IG, which is in line with the overall strong positive sentiment of the sentence. The model predicts this new sentence as positive sentiment, and the confidence score for this prediction is slightly higher than the previous sentence where instead of “often” we had used “sometimes”. This makes sense as well because “often” enhances the positive sentiment slightly more than using “sometimes” in a positive review.
In this second example, we mostly based our observation on LIME and IG, because we could observe visual changes directly from the outputs of these methods. Grad L2 Norm outputs were comparatively inconclusive, highlighting the need to select appropriate methods and compare results between them. The model predictions were in line with our expected class labels and the confidence scores for predictions on the counterfactuals could be justified using salience scores assigned to the new tokens.
Use Case 3: Quality Assurance
A real life use case for the salience maps module can be in Quality Assurance. For example, if there is a failure in production (e.g., wrong results for a search query), we know the text input and the label the model predicted. We can use LIT Salience Maps to debug this failure and figure out which tokens were most influential in the prediction of the wrong label, and which alternative labels could have been predicted (i.e., is there one clear winner, or are there a few that are roughly the same?). Once we are done with debugging using LIT, we can make the necessary changes to the model or training data (eg. adding fail-safes or checks) to solve the production failure.
Conclusion
Three gradient-based salience methods and one black box method are provided out of the box to LIT users who need to use these post-hoc interpretations to make sense of their language model’s predictions. This diverse array of built-in techniques can be used in combination with other LIT modules like counterfactuals to support robust exploration of a model's behavior, as illustrated in this tutorial. And as always, LIT strives to enable users to add their own salience interpreters to allow for a wider variety of use cases beyond these default capabilities!


Having worked as both a musician and a bartender, I know communication between venues and bands can be stressful. Venues are required to reach out to different bands on a monthly basis to fill their calendar and must cruise Facebook to find new entertainment they would like to hire. Musicians must email, call, or literally drive by venues to advertise themselves and give the venue their availability. Booking agents have been a solution in the past but generally take huge cuts from both sides and some are just not reliable. As a band I would like the capability to advertise style of music, contact info, and availability and browse several venues in one place to contact them for potential gigs. As a venue I would like one place to browse several bands in my area and see their availability, rates, and musical style without having to cruise Facebook trying to find talent. Enter Rapsheet, a one stop app where bands and venues can sign up for an account and join an online music community to simplify the booking process.
Sign up and create a profile
Find a band to play or a venue to play at
Schedule your availability and book gigs now