Showing posts with label in. Show all posts
Showing posts with label in. Show all posts

Thursday, November 3, 2016

Creating a templated Binary Search Tree Class in C

Creating a basic template Tree Class in C++
(Works in Linux and Windows)

If you just want the code and not the walkthrough, it is attached at the end (I use the GNU GPL license, so do whatever you want with the code as long as you mention me).

There a multiple benefits of creating a Tree class based on a template. With a template, the tree can be a container for anything while still being fairly clean code. We will also create this class to be easily inherited for other trees such as an AVL and Huffman tree (which we will implement later).

A tree is a widely used data structure which organizes a set of nodes containing data. More can be found on it here: http://en.wikipedia.org/wiki/Tree_%28data_structure%29

This tree will be a Binary Search Tree; however, it will be easily inheritable so that other trees (Binary trees, such as AVL and Red-Black) can be defined based on it.

First we will set up our Node as a holder for the data and tree information such as the parent and connected nodes (the leaves). I overload the < operator so that we can search and sort this tree using the c++ algorithm include if we so desire.

template <class T>
class Node {
public:
    T data;
    Node *left, *right, *parent;

    Node() {
        left = right = parent = NULL;
    };
    Node(T &value) {
        data = value;
    };
    ~Node() {
    };   
    void operator= (const Node<T> &other) {
        data = other.data;
    };
    bool operator< (T &other) {
        return (data < other);
    };
};

Our tree will basically just be a bunch of these Nodes pointing to each other, with some functions to manage the data structure.

template <class T>
class Tree {
public:
    Tree() {
        root = NULL;
    };

    ~Tree() {
        m_destroy(root);
    };

    //We will define these all as virtuals for inherited trees (like a Huffman Tree and AVL Tree shown later)
    virtual void insert(T &value) {
        m_insert(root,NULL,value);
    };
    virtual Node<T>* search(T &value) {
        return m_search(root,value);
    };
    virtual bool remove(T &value) {
        return m_remove(root,value);
    };
    virtual bool operator< (Tree<T> &other) {
        return (root->data < other.first()->data);
    };
    void operator= (Tree<T> &other) {
        m_equal(root,other.first());
    };
    Node<T>*& first() {
        return root;
    };


protected:
    //this will be our root node and private functions
    Node<T> *root;
    void m_equal(Node<T>*& node, Node<T>* value) {
        if(value != NULL) {
            node = new Node<T>();
            *node = *value;
            if(value->left != NULL)
                m_equal(node->left, value->left);
            if(value->right != NULL)
                m_equal(node->right, value->right);
        }
    }

    void m_destroy(Node<T>* value) {
        if(value != NULL) {
            m_destroy(value->left);
            m_destroy(value->right);
            delete value;
        }
    };
    void m_insert(Node<T> *&node, Node<T> *parent, T &value) {
        if(node == NULL) {
            node = new Node<T>();
            *node = value;
            node->parent = parent;
        } else if(value < node->data) {
            m_insert(node->left,node,value);
        } else
            m_insert(node->right,node,value);
    };
    void m_insert(Node<T> *&node, Node<T> *parent, Tree<T> &tree) {
        Node<T> *value = tree.first();
        if(node == NULL) {
            node = new Node<T>();
            *node = *value;
            node->parent = parent;
        } else if(value->data < node->data) {
            m_insert(node->left,tree);
        } else
            m_insert(node->right,tree);
    };
    Node<T>* m_search(Node<T> *node, T &value) {
        if(node == NULL)
            return NULL;
        else if(value == node->data)
            return node;
        else if(value < node->data)
            return m_search(node->left,value);
        else
            return m_search(node->right,value);
    };

    bool m_remove(Node<T> *node, T &value) {
        //messy, need to speed this up later
        Node<T> *tmp = m_search(root,value);
        if(tmp == NULL)
            return false;
        Node<T> *parent = tmp->parent;
        //am i the left or right of the parent?
        bool iamleft = false;
        if(parent->left == tmp)
            iamleft = true;
        if(tmp->left != NULL && tmp->right != NULL) {
            if(parent->left == NULL || parent->right == NULL) {
                parent->left = tmp->left;
                parent->right = tmp->right;
            } else {
                if(iamleft)
                    parent->left = tmp->left;
                else
                    parent->right = tmp->left;
                T data = tmp->right->data;
                delete tmp;
                m_insert(root,NULL,data);
            }
        } else if(tmp->left != NULL) {
            if(iamleft)
                parent->left = tmp->left;
            else
                parent->right = tmp->left;
        } else if(tmp->right != NULL ) {
            if(iamleft)
                parent->left = tmp->right;
            else
                parent->right = tmp->right;
        } else {
            if(iamleft)
                parent->left = NULL;
            else
                parent->right = NULL;
        }
        return true;
    };
};

And thats all we need for a basic binary search tree. The full code is shown below

Tree.h 

Consider donating to further my tinkering.


Places you can find me
Read More..

Sunday, October 23, 2016

Sign in to edx org with Google and Facebook and



Google is passionate about online education. In addition to our own Course Builder project, we’re also partners with edX, a not-for-profit that shares our desire for scalable, quality education for everyone. Their software, Open edX, lets people make educational content and deliver it online to anybody, anytime, anywhere. It powers their own site, edx.org, and is also used by companies and universities worldwide.

Today we’re very pleased to announce that you can now sign in to edx.org with your Google or Facebook account:
Until recently, users who wanted to take advantage of the high quality content on edx.org needed to create a new account first. This is a painful, error prone process?really, who wants to worry about yet another password? So we added the ability to use over 60 external authentication providers to Open edX, with support for everything from open standards like OpenID or OAuth 2.0, to custom university single sign-on systems. For their edx.org site, edX decided to let users pick between Google, Facebook, and a custom username and password.

If you run Open edX, you can also use this feature now. The authentication module is extensible so you can add any third-party provider you want if your favorite is not yet supported. And the feature is completely configurable, so you can pick whatever third-party authentication systems are best for your users, including none at all. It’s totally up to you.

By simultaneously increasing user choice, convenience, and security, we hope to make open online education even easier and safer to use, whether people pick Course Builder or Open edX for authoring and delivering courses. We’re very grateful to our partners at edX for working with us in this exciting field.
Read More..

Friday, October 14, 2016

Throwing fireballs with the Kinect and Oculus Rift in Unity 3D

I decided I wanted to make a small game where you were a viking and you threw fireballs at enemy vikings on Unity 3D. The catch is, I wanted to actually throw the fireballs, so I wanted to use the Kinect, and I wanted to actually see if I was the character, so I wanted to use the Oculus Rift.

Here is a quick video of the results before we get on to the discussion:



Basically this started because a colleague at Georgia Tech, Alex Trevor (soon to be Dr,), had an Oculus Rift and mounted a camera on top of it to see the Kinect output with the Oculus Rift. I thought that was really cool and had previously worked on a game that used the Kinect Skeleton to throw fireballs (though I lost all the source code for the first version). I really wanted to combine those ideas and had to start over.

Luckily, Dr. Brian Peasley (now at Microsoft) came to my rescue as always and gifted me an Oculus Rift. 


To explain a bit, the Oculus Rift is an immersive virtual reality headset. The two images are displayed on the screen above because one is projected to the left eye and one to the right eye. As you rotate your head, the images change and it feels like you are looking at a real environment (it is pretty amazing). This is why there are two images in the video (and pretty much all Oculus Rift demos). To appreciate it fully, I recommend wearing an Oculus Rift while watching the video.



The Kinect everyone should know by now. It can yield a really good skeletal estimation of a persons joints from the depth data, which can then be used to represent gestures.

I had some time this week so I grabbed the Unity third person MMO example, added the Kinect scripts provided by CMU here, created my own fireball and fireball related prefabs and scripts, added the Oculus package, changed all the camera stuff to make it first person, and tweaked a lot of stuff. Daniel Castro (also at Georgia Tech) was nice enough to help me film me making a fool of myself.
It was obviously a bit more complicated than that. Lots of tinkering and scripting was involved to get things working but that is the output. Here at RIM, we are working on lots of other cool things and if you are interested, check out some of my other projects.

Ive uploaded the source for public use and you can find it here (just make sure to please cite me):
https://github.com/StevenHickson/UnityKinectOculus

The fireball script just takes two Game objects (the Vikings left hand normalized by your hip) and uses a velocity measurement to determine if you want to throw the fireball, then it creates a fireball and sets its velocity to your hands velocity whenever you throw. This can be done easily with a small amount of code as below:
void Update () {
Vector3 norm_hand = HandPosition.transform.position - HipPosition.transform.position;
Vector3 velocity = (norm_hand - lastPos) / Time.deltaTime;
float dist = velocity.magnitude;
if (Input.GetButtonDown("Fire1") || (dist > THRESH && dist < MAX_THRESH)) {
                        Rigidbody clone;
Vector3 pos = HandPosition.transform.position;
pos.z += 1;
                        clone = (Rigidbody)Instantiate(Projectile, pos, transform.rotation);
clone.velocity = velocity * SPEED;
                }
lastPos = norm_hand;
}

And thats it for the fireball. Then there are some scripts destroying the fireball and vikings when they collide.
For the mapping of the joints to the main Viking, each joint position of the Viking is mapped to the corresponding Kinect Skeleton joints with GameObjects in the KinectControllerScript.
Then the Oculus SDK is used to create the camera and player control mapped to the main viking.
For all the code, see the Github project

Im using a friends version of Unity Pro because Im a poor graduate student. So please donate if you liked this work so I can continue doing it. All of these gadgets are expensive and I do all this and post it for free.

So please consider donating to further my tinkering!!



Places you can find me
Read More..

Friday, October 7, 2016

How to allow users to Run only specified programs in Windows 7




You can allow users to run only specified programs in Windows 7 operating systems. It is up to you if you want your shared computer to allow users to run only specified programs in Windows 7. A shared computer in an office, for example, can be set in the same way if the company does not want the employees to run all types of programs. You can allow the users to run only specified programs in Windows 7 by using the Local Group Policy. However, you cannot do this in the Home editions of Windows 7 as it does not provide the Local Group Policy Editor.
Click on the Start button.

Type “gpedit.msc” in the search box of the Start menu and press the Enter button on the keyboard.
Local Group Policy Editor will open. Scroll down to “User Configuration”, “Administrative Templates” and then “System” on the left hand side of the window pane.
On the right hand side of the window, under “Setting”, navigate and double-click on “Run only specified Windows applications”.



Select Enabled from the window.
Click on “Show” under Options. 



The Show Contents window pane will appear. Here you can type the applications you want to let the users run.
After you are done, click on the OK button.
Close the Local Group Policy Editor.



After this, if someone attempts to run an app which was not specified by you, he will get this error message:



This feature to allow users to run only specified programs in Windows 7 is the best at preventing the users from accessing applications you don’t want them to use on a particular computer.

Read More..

Tuesday, October 4, 2016

What does Privacy Mean to New Zealanders in the Internet Age

This Thursday is the 1st lecture in the annual Gibbons Memorial lecture series. The first lecture is by Professor Miriam Lips of the School of Government, Victoria University of Wellington, titled: What does Privacy Mean to New Zealanders in the Internet Age?

When: 6pm (refreshments) for 6.30pm lecture start, Thursday 1st May, 2014
Where: Owen G Glenn Building, Room OGGB3/260-092
Note that there is public parking in the basement of the Owen G Glenn Building at 12 Grafton Road.

Miriam Lips is the first Professor of E-Government at Victoria University of Wellington. This chair is sponsored by industry - Datacom System, FX Networks, Microsoft New Zealand – and the NZ government - the State Services Commission and the Department of Internal Affairs.

Professor Lips holds a MSc and a PhD from Erasmus University Rotterdam and an EMPA from Erasmus University, Leiden University and the Hochschule für Verwaltungswissen-schaften, Speyer. She has held academic positions at the University of Oxford and Tilburg University. Her current research includes management of online identity, use of social media for public engagement, the use of e-campaigning and the use of new media in disaster management.

Synopsis: Based on a 2013 survey with a representative sample of the New Zealand population, this talk will explore how, and to what extent, different groups of the New Zealand population are disclosing and protecting their personal information in varying online relationships with the private sector, government, and family and friends through social networking. The meaning of privacy for people from different age groups, ethnicities, educational backgrounds, and income groups will be discussed, and the implications for a population which increasingly exchanges their identity information online, against the backdrop of new privacy challenges and risks emerging from the use of Big Data.

from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

via Personal Recipe 895909

Read More..

Saturday, October 1, 2016

How to measure translation quality in your user interfaces



Worldwide, there are about 200 languages that are spoken by at least 3 million people. In this global context, software developers are required to translate their user interfaces into many languages. While graphical user interfaces have evolved substantially when compared to text-based user interfaces, they still rely heavily on textual information. The perceived language quality of translated user interfaces (UIs) can have a significant impact on the overall quality and usability of a product. But how can software developers and product managers learn more about the quality of a translation when they don’t speak the language themselves?

Key information in interaction elements and content are mostly conveyed through text. This aspect can be illustrated by removing text elements from a UI, as shown in the the figure below.
Three versions of the YouTube UI: (a) the original, (b) YouTube without text elements, and (c) YouTube without graphic elements. It gets apparent how the textless version is stripped of the most useful information: it is almost impossible to choose a video to watch and navigating the site is impossible.
In "Measuring user rated language quality: Development and validation of the user interface Language Quality Survey (LQS)", recently published in the International Journal of Human-Computer Studies, we describe the development and validation of a survey that enables users to provide feedback about the language quality of the user interface.

UIs are generally developed in one source language and translated afterwards string by string. The process of translation is prone to errors and might introduce problems that are not present in the source. These problems are most often due to difficulties in the translation process. For example, the word “auto” can be translated to French as automatique (automatic) or automobile (car), which obviously has a different meaning. Translators might chose the wrong term if context is missing during the process. Another problem arises from words that behave as a verb when placed in a button or as a noun if part of a label. For example, “access” can stand for “you have access” (as a label) or “you can request access” (as a button).

Further pitfalls are gender, prepositions without context or other characteristics of the source text that might influence translation. These problems sometimes even get aggravated by the fact that translations are made by different linguists at different points in time. Such mistranslations might not only negatively affect trustworthiness and brand perception, but also the acceptance of the product and its perceived usefulness.

This work was motivated by the fact that in 2012, the YouTube internationalization team had anecdotal evidence which suggested that some language versions of YouTube might benefit from improvement efforts. While expert evaluations led to significant improvements of text quality, these evaluations were expensive and time-consuming. Therefore, it was decided to develop a survey that enables users to provide feedback about the language quality of the user interface to allow a scalable way of gathering quantitative data about language quality.

The Language Quality Survey (LQS) contains 10 questions about language quality. The first five questions form the factor “Readability”, which describes how natural and smooth to read the used text is. For instance, one question targets ease of understanding (“How easy or difficult to understand is the text used in the [product name] interface?”). Questions 6 to 9 summarize the frequency of (in)consistencies in the text, called “Linguistic Correctness”. The full survey can be found in the publication.

Case study: applying the LQS in the field

As the LQS was developed to discover problematic translations of the YouTube interface and allow focused quality improvement efforts, it was made available in over 60 languages and data were gathered for all these versions of the YouTube interface. To understand the quality of each UI version, we compared the results for the translated versions to the source language (here: US-English). We inspected first the global item, in combination with Linguistic Correctness and Readability. Second, we inspected each item separately, to understand which notion of Linguistic Correctness or Readability showed worse (or better) values. Here are some results:
  • The data revealed that about one third of the languages showed subpar language quality levels, when compared to the source language.
  • To understand the source of these problems and fix them, we analyzed the qualitative feedback users had provided (every time someone selected the lower two end scale points, pointing at a problem in the language, a text box was surfaced, asking them to provide examples or links to illustrate the issues).
  • The analysis of these comments provided linguists with valuable feedback of various kinds. For instance, users pointed to confusing terminology, untranslated words that were missed during translation, typographical or grammatical problems, words that were translated but are commonly used in English, or screenshots in help pages that were in English but needed to be localized. Some users also pointed to readability aspects such as sections with old fashioned or too formal tone as well as too informal translations, complex technical or legal wordings, unnatural translations or rather lengthy sections of text. In some languages users also pointed to text that was too small or criticized the readability of the font that was used.
  • In parallel, in-depth expert reviews (so-called “language find-its”) were organized. In these sessions, a group of experts for each language met and screened all of YouTube to discover aspects of the language that could be improved and decided on concrete actions to fix them. By using the LQS data to select target languages, it was possible to reduce the number of language find-its to about one third of the original estimation (if all languages had been screened).
LQS has since been successfully adapted and used for various Google products such as Docs, Analytics, or AdWords. We have found the LQS to be a reliable, valid and useful tool to approach language quality evaluation and improvement. The LQS can be regarded as a small piece in the puzzle of understanding and improving localization quality. Google is making this survey broadly available, so that everyone can start improving their products for everyone around the world.
Read More..

Friday, September 23, 2016

How good you are in SQL Simple SQL Quiz

This is a simple online Quiz to test your knowledge in SQL. At the end you can see the result.
Every time you refresh the page you will see a new set of questions.

Powered by : http://www.sqlquiz.com

Read More..

Wednesday, September 21, 2016

Play movies in RAR file without extracting

Play movies in RAR file without extracting.
Most people like downloading movies or video files from internet, and those large files are split in several parts before being uploaded to the net. If you have downloaded movies from Rapidshare then you must have known that how troublesome is downloading those RAR video files and extract them later.

Just use this tool called “Dziobas Rar Player” that can play various internet downloaded movies with codecs like Divx or Xvid even without extracting the RAR files. The player is capable of playing files in formats AVI, MPGE, RMVB, OGG, MP3, RAR, MKV, MKA and some others.

Just download this tool and extract and run the DziobasPlayer.exe, You can then drag and drop the RAR files in the window and see the videos even without extracting.
Advantages of Dziobas RAR Player:
  1. Small and free.
  2. Play videos without the need to install codecs in the system.
  3. Play the movie RAR files even without extracting them.
  4. Also plays the corrupted RAR archive.
  5. Requires no installation.
The only disadvantage is that you won’t be able to seek videos.
Download Dziobas RAR Player
[Link 1] [Link 2]
Read More..

Sunday, September 18, 2016

New Research Challenges in Language Understanding



We held the first global Language Understanding and Knowledge Discovery Focused Faculty Workshop in Nanjing, China, on November 14-15, 2013. Thirty-four faculty members joined the workshop arriving from 10 countries and regions across APAC, EMEA and the US. Googlers from Research, Engineering and University Relations/University Programs also attended the event.

The 2-day workshop included keynote talks, panel discussions and break-out sessions [agenda]. It was an engaging and productive workshop, and we saw lots of positive interactions among the attendees. The workshop encouraged communication between Google and faculty around the world working in these areas.

Research in text mining continues to explore open questions relating to entity annotation, relation extraction, and more. The workshop’s goal was to brainstorm and discuss relevant topics to further investigate these areas. Ultimately, this research should help provide users search results that are much more relevant to them.

At the end of the workshop, participants identified four topics representing challenges and opportunities for further exploration in Language Understanding and Knowledge Discovery:

  • Knowledge representation, integration, and maintenance
  • Efficient and scalable infrastructure and algorithms for inferencing
  • Presentation and explanation of knowledge
  • Multilingual computation

Going forward, Google will be collaborating with academic researchers on a position paper related to these topics. We also welcome faculty interested in contributing to further research in this area to submit a proposal to the Faculty Research Awards program. Faculty Research Awards are one-year grants to researchers working in areas of mutual interest.

The faculty attendees responded positively to the focused workshop format, as it allowed time to go in depth into important and timely research questions. Encouraged by their feedback, we are considering similar workshops on other topics in the future.
Read More..

Monday, September 5, 2016

Hacking Snapchats people verification in less than 100 lines

I woke up this morning and saw this article detailing Snapchats new people verification system.

(Credit: Screenshot by Lance Whitney/CNET)
You may have seen it but if not I will summarize it for you. They basically have you choose each image with the Snapchat ghost to prove you are a person. It is kind of like a less annoying captcha.

The problem with this is that the Snapchat ghost is very particular. You could even call it a template. For those of you familiar with template matching (what they are asking you to do to verify your humanity), it is one of the easier tasks in computer vision.

This is an incredibly bad way to verify someone is a person because it is such an easy problem for a computer to solve.

After I read this, I spent around ~30 minutes writing up some code in order to make a computer do this. Now there are many ways of solving this problem, HoG probably would have been best or even color thresholding and PCA for blob recognition but it would take more time and Im lazy (read: efficient). I ended up using OpenCV and going with simple thresholding, SURF keypoints and FLANN matching with a uniqueness test to determine that multiple keypoints in the training image werent being singularly matched in the testing image.

First, I extract the different images from the slide above, then I threshold them and the ghost template to find objects that are that color. Next, I extract feature points and descriptors from the test image and the template using SURF and match them using FLANN. I only use the "best" matches using a distance metric and then check all the matches for uniqueness to verify one feature in the template isnt matching most of the test features. If the uniqueness is high enough and enough features are found, we call it a ghost.

With very little effort, my code was able to "find the ghost" in the above example with 100% accuracy. Im not saying it is perfect, far from it. Im just saying that if it takes someone less than an hour to train a computer to break an example of your human verification system, you are doing something wrong. There are a ton of ways to do this using computer vision, all of them quick and effiective. Its a numbers game with computers and Snapchats verification system is losing.

Below is an example of the output of the code:
Found a Ghost!

And you can find the code on my github here: https://github.com/StevenHickson/FindTheGhost


Note: This just relates to Snapchats new captcha system. The reason they implemented this was because of the past hacks by people who put way more time and thought into a harder problem. They can be found here:
Graham Smith - https://twitter.com/neuegram - http://neuebits.com/
Adam Caudill - http://adamcaudill.com/2012/12/31/revisiting-snapchat-api-and-security/
Gibson Security - http://gibsonsec.org/

Consider donating to further my tinkering.

Places you can find me
Read More..

Friday, September 2, 2016

Innovation in Airline Human Computer Interaction

This Thursday evenings Gibbons Lecture is by Paul McGlashan, Chief Architect, for Air New Zealand. The lecture titled Innovation in Airline Human-Computer Interaction: from ALC to IoT  will describe how Air New Zealand has taken control of its IT in-house and has been correspondingly more innovative than its competitors. The lecture is this Thursday the 14th at 6:00pm for a 6:30pm start. Click the lecture link for full venue details and if you cant attend the lecture will be streamed live and after the event.

from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Delete or edit this Recipe

Read More..

The reusable holdout Preserving validity in adaptive data analysis



Machine learning and statistical analysis play an important role at the forefront of scientific and technological progress. But with all data analysis, there is a danger that findings observed in a particular sample do not generalize to the underlying population from which the data were drawn. A popular XKCD cartoon illustrates that if you test sufficiently many different colors of jelly beans for correlation with acne, you will eventually find one color that correlates with acne at a p-value below the infamous 0.05 significance level.
Image credit: XKCD
Unfortunately, the problem of false discovery is even more delicate than the cartoon suggests. Correcting reported p-values for a fixed number of multiple tests is a fairly well understood topic in statistics. A simple approach is to multiply each p-value by the number of tests, but there are more sophisticated tools. However, almost all existing approaches to ensuring the validity of statistical inferences assume that the analyst performs a fixed procedure chosen before the data are examined. For example, “test all 20 flavors of jelly beans”. In practice, however, the analyst is informed by data exploration, as well as the results of previous analyses. How did the scientist choose to study acne and jelly beans in the first place? Often such choices are influenced by previous interactions with the same data. This adaptive behavior of the analyst leads to an increased risk of spurious discoveries that are neither prevented nor detected by standard approaches. Each adaptive choice the analyst makes multiplies the number of possible analyses that could possibly follow; it is often difficult or impossible to describe and analyze the exact experimental setup ahead of time.

In The Reusable Holdout: Preserving Validity in Adaptive Data Analysis, a joint work with Cynthia Dwork (Microsoft Research), Vitaly Feldman (IBM Almaden Research Center), Toniann Pitassi (University of Toronto), Omer Reingold (Samsung Research America) and Aaron Roth (University of Pennsylvania), to appear in Science tomorrow, we present a new methodology for navigating the challenges of adaptivity. A central application of our general approach is the reusable holdout mechanism that allows the analyst to safely validate the results of many adaptively chosen analyses without the need to collect costly fresh data each time.

The curse of adaptivity

A beautiful example of how false discovery arises as a result of adaptivity is Freedman’s paradox. Suppose that we want to build a model that explains “systolic blood pressure” in terms of hundreds of variables quantifying the intake of various kinds of food. In order to reduce the number of variables and simplify our task, we first select some promising looking variables, for example, those that have a positive correlation with the response variable (systolic blood pressure). We then fit a linear regression model on the selected variables. To measure the goodness of our model fit, we crank out a standard F-test from our favorite statistics textbook and report the resulting p-value.
Inference after selection: We first select a subset of the variables based on a data-dependent criterion and then fit a linear model on the selected variables.
Freedman showed that the reported p-value is highly misleading - even if the data were completely random with no correlation whatsoever between the response variable and the data points, we’d likely observe a significant p-value! The bias stems from the fact that we selected a subset of the variables adaptively based on the data, but we never account for this fact. There is a huge number of possible subsets of variables that we selected from. The mere fact that we chose one test over the other by peeking at the data creates a selection bias that invalidates the assumptions underlying the F-test.

Freedman’s paradox bears an important lesson. Significance levels of standard procedures do not capture the vast number of analyses one can choose to carry out or to omit. For this reason, adaptivity is one of the primary explanations of why research findings are frequently false as was argued by Gelman and Loken who aptly refer to adaptivity as “garden of the forking paths”.

Machine learning competitions and holdout sets

Adaptivity is not just an issue with p-values in the empirical sciences. It affects other domains of data science just as well. Machine learning competitions are a perfect example. Competitions have become an extremely popular format for solving prediction and classification problems of all sorts.

Each team in the competition has full access to a publicly available training set which they use to build a predictive model for a certain task such as image classification. Competitors can repeatedly submit a model and see how the model performs on a fixed holdout data set not available to them. The central component of any competition is the public leaderboard which ranks all teams according to the prediction accuracy of their best model so far on the holdout. Every time a team makes a submission they observe the score of their model on the same holdout data. This methodology is inspired by the classic holdout method for validating the performance of a predictive model.
Ideally, the holdout score gives an accurate estimate of the true performance of the model on the underlying distribution from which the data were drawn. However, this is only the case when the model is independent of the holdout data! In contrast, in a competition the model generally incorporates previously observed feedback from the holdout set. Competitors work adaptively and iteratively with the feedback they receive. An improved score for one submission might convince the team to tweak their current approach, while a lower score might cause them to try out a different strategy. But the moment a team modifies their model based on a previously observed holdout score, they create a dependency between the model and the holdout data that invalidates the assumption of the classic holdout method. As a result, competitors may begin to overfit to the holdout data that supports the leaderboard. This means that their score on the public leaderboard continues to improve, while the true performance of the model does not. In fact, unreliable leaderboards are a widely observed phenomenon in machine learning competitions.

Reusable holdout sets

A standard proposal for coping with adaptivity is simply to discourage it. In the empirical sciences, this proposal is known as pre-registration and requires the researcher to specify the exact experimental setup ahead of time. While possible in some simple cases, it is in general too restrictive as it runs counter to today’s complex data analysis workflows.

Rather than limiting the analyst, our approach provides means of reliably verifying the results of an arbitrary adaptive data analysis. The key tool for doing so is what we call the reusable holdout method. As with the classic holdout method discussed above, the analyst is given unfettered access to the training data. What changes is that there is a new algorithm in charge of evaluating statistics on the holdout set. This algorithm ensures that the holdout set maintains the essential guarantees of fresh data over the course of many estimation steps.
The limit of the method is determined by the size of the holdout set - the number of times that the holdout set may be used grows roughly as the square of the number of collected data points in the holdout, as our theory shows.

Armed with the reusable holdout, the analyst is free to explore the training data and verify tentative conclusions on the holdout set. It is now entirely safe to use any information provided by the holdout algorithm in the choice of new analyses to carry out, or the tweaking of existing models and parameters.

A general methodology

The reusable holdout is only one instance of a broader methodology that is, perhaps surprisingly, based on differential privacy—a notion of privacy preservation in data analysis. At its core, differential privacy is a notion of stability requiring that any single sample should not influence the outcome of the analysis significantly.
Example of a stable learning algorithm: Deletion of any single data point does not affect the accuracy of the classifier much.
A beautiful line of work in machine learning shows that various notions of stability imply generalization. That is any sample estimate computed by a stable algorithm (such as the prediction accuracy of a model on a sample) must be close to what we would observe on fresh data.

What sets differential privacy apart from other stability notions is that it is preserved by adaptive composition. Combining multiple algorithms that each preserve differential privacy yields a new algorithm that also satisfies differential privacy albeit at some quantitative loss in the stability guarantee. This is true even if the output of one algorithm influences the choice of the next. This strong adaptive composition property is what makes differential privacy an excellent stability notion for adaptive data analysis.

In a nutshell, the reusable holdout mechanism is simply this: access the holdout set only through a suitable differentially private algorithm. It is important to note, however, that the user does not need to understand differential privacy to use our method. The user interface of the reusable holdout is the same as that of the widely used classical method.

Reliable benchmarks

A closely related work with Avrim Blum dives deeper into the problem of maintaining a reliable leaderboard in machine learning competitions (see this blog post for more background). While the reusable holdout could directly be used for this purpose, it turns out that a variant of the reusable holdout, we call the Ladder algorithm, provides even better accuracy.

This method is not just useful for machine learning competitions, since there are many problems that are roughly equivalent to that of maintaining an accurate leaderboard in a competition. Consider, for example, a performance benchmark that a company uses to test improvements to a system internally before deploying them in a production system. As the benchmark data set is used repeatedly and adaptively for tasks such as model selection, hyper-parameter search and testing, there is a danger that eventually the benchmark becomes unreliable.

Conclusion

Modern data analysis is inherently an adaptive process. Attempts to limit what data scientists will do in practice are ill-fated. Instead we should create tools that respect the usual workflow of data science while at the same time increasing the reliability of data driven insights. It is our goal to continue exploring techniques that can help to create more reliable validation techniques and benchmarks that track true performance more accurately than existing methods.
Read More..

Sunday, August 28, 2016

This day in history the first tweet

On March 21 2006 Jack Dorsey sent the very first tweet. Like many tweets not especially informative and presumable Jack didnt have many, if any, followers. Twitter was opened to the public that July and had its first major success at the South by Southwest (SXSW) conference in 2007, shortly after it had been made into a company. And the rest< as they say, is history. You can follow me and this blog @driwatson

from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

via Personal Recipe 895909

Read More..

Saturday, August 27, 2016

How to display codes in blogger post

Display code in blogger postCode without border.

Display code in blogger postCode with border.

Have you ever tried to display codes in blogger. Many blog posts display codes. I always wonder how is this code displayed. After deep search with Google, I found the secret. In this post, i will share with you, how to display codes as it is in any of your post.

  • First of all copy your code and encode your code. Click here to do this.
  • After you click on encode button your code will be encoded. Copy the code.
  • Paste it in your post. Thats it.
  • If you want to add a border or put the code inside a box, Place the encoded code inside <fieldset style="border: 1px dotted ;>------your code------</fieldset> tag

Lets try one:
  • Go to Blogger >> Posting >> Create.
  • Copy the code : <data:blog.pageTitle/> </title> </b:if> or <data:blog.pageTitle/> </title>
  • Encode it.
  • To display code inside a box, paste the code inside this tag. <fieldset style="border: 1px dotted ;>------your code------</fieldset>
  • To display without box, simply paste it anywhere you want.
  • Try Clicking on Preview.

Happy Blogging.
Read More..

Watson in your pocket

No relation to me -  IBMs Watson, the cognitive computer that can be an expert in any subject, is moving to the cloud, and will soon be accessible via smartphone app An article in the New Scientist says that Watson is moving into the cloud and will soon be accessible via smartphone. If you could quiz Watson, IBMs all-knowing supercomputer, from an app on your phone, what would you ask it? In February this year IBM invited potential app developers to pitch them their ideas. IBM whittled 100s of ideas down to 3 Grand Finalists. You can get more information on them here.

from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Turn off or edit this Recipe

Read More..

Saturday, August 20, 2016

Unveiling of Display on “Computer Graphics in 1984”

You may have missed this and have you havent visited our Computer History Displays recently then perhaps you should return. On 25th August our Computer Science Department inaugurated the latest addition to its Computer History Displays - the new display in the 5th-floor lobby being devoted to computers & graphics. The main items in the new display are Computer Aided Design machines preserved by our Engineering Faculty, - a Tektronix 40xx terminal, an IBM 5080 CAD display and its replacement, an IBM RS6000, and a large plotter. The display was unveiled by Professor Gordon Mallinson from the Department of Mechanical Engineering. 
   Although most of the equipment is for CAD, the display panel draws on the fact that the 5080 was installed in 1984 to highlight that year as being a turning point in computing history, as it saw the introduction of graphical computer interfaces with the Apple Macintosh. This was the first time that a WIMPs system (Windows, Icons, Menus, Pointer) was available to the general public, although "clunky" by todays standards. This was also the beginning of user-defined fonts, leading to the plethora of brilliant designs available today, such as the font McCahon by Luke Wood of Canterbury University:





from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Turn off or edit this Recipe

Read More..

Program for calculator in JAVA

This is the source code for a calculater in java
import java.io.*;
import java.awt.*;
import java.applet.*;
import javax.swing.*;
import java.awt.event.*;

public class Calculator extends JApplet implements ActionListener
{
int choice;
double a,b, result = 0;
String str;
JTextField jt;
JButton btn0, btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9;
JButton btnAdd, btnSub, btnMul, btnDiv, btnEqual, btnDot, btnCl;
JPanel pn1, pn2;
Container cp;
public void init() // Initializing Applet & its Components
{
cp = getContentPane();
cp.setLayout ( new BorderLayout() );
jt = new JTextField(10);
jt.setHorizontalAlignment(4);
pn1 = new JPanel();
pn2 = new JPanel();
pn1.setLayout ( new FlowLayout() );
pn2.setLayout ( new GridLayout(4, 4) );
btnCl = new JButton ("Clear");
btn0 = new JButton ("0");
btn1 = new JButton ("1");
btn2 = new JButton ("2");
btn3 = new JButton ("3");
btn4 = new JButton ("4");
btn5 = new JButton ("5");
btn6 = new JButton ("6");
btn7 = new JButton ("7");
btn8 = new JButton ("8");
btn9 = new JButton ("9");
btnAdd = new JButton ("+");
btnSub = new JButton ("-");
btnMul = new JButton ("*");
btnDiv = new JButton ("/");
btnEqual = new JButton ("=");
btnDot = new JButton (".");
addButtons();
addListeners();
pn1.add (jt);
pn1.add (btnCl);
cp.add (pn1, BorderLayout.NORTH);
cp.add (pn2, BorderLayout.CENTER);
jt.setText("");
}

public void addListeners() // Adding Listeners to all Components
{
btn0.addActionListener ( this );
btn1.addActionListener ( this );
btn2.addActionListener ( this );
btn3.addActionListener ( this );
btn4.addActionListener ( this );
btn5.addActionListener ( this );
btn6.addActionListener ( this );
btn7.addActionListener ( this );
btn8.addActionListener ( this );
btn9.addActionListener ( this );
btnDot.addActionListener ( this );
btnCl.addActionListener ( this );
btnAdd.addActionListener ( this );
btnSub.addActionListener ( this );
btnMul.addActionListener ( this );
btnDiv.addActionListener ( this );
btnEqual.addActionListener ( this );
}

public void addButtons() // Adding all Components to JPanel
{
pn2.add ( btn7 );
pn2.add ( btn8 );
pn2.add ( btn9 );
pn2.add ( btnDiv );
pn2.add ( btn4 );
pn2.add ( btn5 );
pn2.add ( btn6 );
pn2.add ( btnMul );
pn2.add ( btn1 );
pn2.add ( btn2 );
pn2.add ( btn3 );
pn2.add ( btnSub );
pn2.add ( btn0 );
pn2.add ( btnDot );
pn2.add ( btnAdd );
pn2.add ( btnEqual );
}
public void operation(double a, double b, int op)
{
switch ( choice )
{
case 1 :
{ result = a + b; break; }
case 2 :
{ result = a - b; break; }
case 3 :
{ result = a * b; break; }
case 4 :
{ result = a / b; break; }
default :
{ jt.setText("0"); break; }
}
}

public void actionPerformed(ActionEvent e) // Actions to be performed
{ // whenever event is triggered
try
{
str = (String)e.getActionCommand();
if ( str = = "+" )
{
a=Double.parseDouble (jt.getText());
jt.setText("");
choice = 1;
}
else if ( str = = "-" )
{
a=Double.parseDouble (jt.getText());
jt.setText("");
choice = 2;
}
else if ( str = = "*" )
{
a=Double.parseDouble (jt.getText());
jt.setText("");
choice = 3;
}
else if ( str = = "/" )
{
a=Double.parseDouble (jt.getText());
jt.setText("");
choice = 4;
}
else if ( str = = "=" )
{
b = Double.parseDouble (jt.getText());
operation(a, b, choice);
jt.setText("");
System.out.println(result);
}
else if ( str = = "Clear" )
{
jt.setText("");
choice = 0;
a = b = result = 0;
}
else
{
jt.setText( jt.getText() +str );
}
}
catch(Exception ex)
{
jt.setText("Invalid Operation");
System.out.println("Invalid Operation");
}
}
}

//<applet code="Calculator.class" width=200 height=200></applet>
Read More..

Wednesday, August 10, 2016

PPT Presentation on Memory Management in Winnows2000 and WindowsXP

Below is the presentation on Memory Management
PPT Presentation on Memory Management in Winnows2000 and WindowsXP
Some of the important points are listed below:

  • Memory performs
  • In WINDOWS 2000
  • Features
  • Management
  • Virtual memory


This article is shared by one of the reader: Tulsi
Download the file here:


  • Memory Management.ppt
Read More..

Sunday, July 31, 2016

How to put a flash mp3 player in blogger post







Here is a simple tutorial to add small flash Mp3 player to any post in blogger.

Copy and paste the below code just before </head> tag in Layout >> Edit Html.
<script src=http://googlepage.googlepages.com/player.js type=text/javascript/>

Copy the below code and paste it wherever you want the flash player to be displayed, but paste it in the Edit Html tab of Create Post.
<object type="application/x-shockwave-flash" data="http://coloriteman.googlepages.com/player.swf" id="audioplayer1" height="17" width="185">
<param name="movie" value="http://coloriteman.googlepages.com/player.swf">
<param name="FlashVars" value="playerID=1&amp;soundFile=http://media.odeo.com/3/3/2/yahoo-song.mp3">
<param name="quality" value="high">
<param name="menu" value="false">
<param name="wmode" value="transparent"></object>

  • Do not forget to replace http://media.odeo.com/3/3/2/yahoo-song.mp3 with the URL of your Mp3
  • You can configure height and weight as required.


Note: If you are using Internet Explorer, you will probably need to click the player twice to make it play. (All other Web browsers will let you click once.) If you do not see the MP3 player, then you dont have the Flash player installed. (More than 90 percent of all Internet users do have it.)
Read More..

Thursday, July 28, 2016

An experiment in digital citizenry

You may already conduct a lot of your life online, but few countries have totally embraced the concept of online citizenship. the small European country of Estonia has been conducting an interesting experiment making all their population "e-Residents". The Register has just published an interesting article on its reach and impact. This was brought to my attention by my colleague Mark Wilson.

from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Turn off or edit this Recipe

Read More..
 
Copyright 2009 Information Blog
Powered By Blogger