Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Java for Data Science

You're reading from   Mastering Java for Data Science Analytics and more for production-ready applications

Arrow left icon
Product type Paperback
Published in Apr 2017
Publisher Packt
ISBN-13 9781782174271
Length 364 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Alexey Grigorev Alexey Grigorev
Author Profile Icon Alexey Grigorev
Alexey Grigorev
Arrow right icon
View More author details
Toc

Case study - page prediction


Now we will continue with our running example, the search engine. What we want to do here is to try to predict whether a URL comes from the first page of the search engine results or not. So, it is time to use the material we have covered so far in this chapter.

In Chapter 2, Data Processing Toolbox, we created the following object to store the information about pages:

public class RankedPage { 
    private String url; 
    private int position; 
    private int page; 
    private int titleLength; 
    private int bodyContentLength; 
    private boolean queryInTitle; 
    private int numberOfHeaders; 
    private int numberOfLinks; 
}

First, we can start by adding a few methods to this object, as follows:

  • isHttps: This should tell us if the URL is HTTPS and can be implemented with url.startsWith("https://")
  • isComDomain: This should tells us if the URL belongs to the COM domain and whether we can implement it with url.contains(".com")
  • isOrgDomain, isNetDomain: This...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image