All About Maps - Episode 1: Showing Routes from GPX files on Maps - Huawei Developers

This article is originally from HUAWEI Developer Forum
Forum link: https://forums.developer.huawei.com/forumPortal/en/home​
All About Maps
Let's talk about maps. I started an open source project called All About Maps (https://github.com/ulusoyca/AllAboutMaps). In this project I aim to demonstrate how we can implement the same map related use cases with different map providers in one codebase. We will use Mapbox Maps, Google Maps, and Huawei HMS Map Kit. This project uses following libraries and patterns:
MVVM pattern with Android Jetpack Libraries
Kotlin Coroutines for asynchronous operations
Dagger2 Dependency Injection
Android Clean Architecture
Note: The codebase changes by time. You can always find the latest code in develop branch. The code when this article is written can be seen by choosing the tag: episode_1-parse-gpx:
https://github.com/ulusoyca/AllAboutMaps/tree/episode_1-parse-gpx/
Motivation
Why do we need maps in our apps? What are the features a developer would expect from a map SDK? Let's try to list some:
Showing a coordinate on a map with camera options (zoom, tilt, latitude, longitude, bearing)
Adding symbols, photos, polylines, polygons to map
Handle user gestures (click, pinch, move events)
Showing maps with different map styles (Outdoor, Hybrid, Satallite, Winter, Dark etc.)
Data visualization (heatmaps, charts, clusters, time-lapse effect)
Offline map visualization (providing map tiles without network connectivity)
Generate snapshot image of a bounded region
We can probably add more items but I believe this is the list of features which all map provider companies would most likely provide. Knowing that we can achieve the same tasks with different map providers, we should not create huge dependencies to any specific provider in our codebase. When a product owner (PO) tells to developers to switch from Google Maps to Mapbox Maps, or Huawei Maps, developers should never see it as a big deal. It is software development. Business as usual.
One would probably think why a PO would want to switch from one map provider to another. In many cases, the reason is not the technical details. For example, Google Play Services may not be available in some devices or regions like China. Another case is when a company X which has a subscription to Mapbox, acquires company Y which uses Google Maps. In this case the transition to one provider is more efficient. Change in the terms of services, and pricing might be other motivations.
We need competition in the market! Let's switch easily when needed but how dependencies make things worse? Problematic dependencies in the codebase are usually created by developing software like there is no tomorrow. It is not always developers' fault. Tight schedules, anti-refactoring minded teams, unorganized plannings may cause careless coding and then eventually to technical depts. In this project, I aim to show how we can encapsulate the import lines below belonging to three different map providers to minimum number of classes with minimum lines:
Code:
import com.huawei.hms.maps.*
import com.google.android.gms.maps.*
import com.mapbox.mapboxsdk.maps.*
It should be noted that the way of achieving this in this post is just one proposal. There are always alternative and better ways of implementations. In the end, as software developers, we should deliver our tasks time-efficiently, without over-engineering.
About the project
In the home page of the project you will see the list of tutorials. Since this is the first blog post, there is only one item for now. To make our life easier with RecyclerViews, I use Epoxy library by Airbnb in the project. Once you click the buttons in the card, it will take to the detail page. Using bottom sheet we can switch between map providers. Note that Huawei Map Kit requires a Huawei mobile phone.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
In this first blog post, we will parse the GPX file of 120 km route of Cappadocia Ultra Trail race and show the route and check points (food stations) on map. I finished this race in 23 hours 45 mins and you can also read my experience here (https://link.medium.com/uWmrWLAzR6). GPX is an open standart which contains route points that constructs a polyline and waypoints which are the attraction location. In this case, the waypoints represents the food and aid stations in the race. We will show the route with a polyline and waypoints with markers on map.
Architecture
Architecture is definitely not an overrated concept. Since the early days of Android, we have been seeking for the best architectural patterns that suits with Android development. We have heard of MVC, MVP, MVVM, MVI and many other patterns will emerge. The change and adaptation to a new pattern is inevitable by time. We should keep in mind some basic and commonly accepted concepts like SOLID principles, seperation of concerns, maintainability, readibility, testablity etc. so that we can switch to between patterns easily when needed.
Nowadays, widely accepted architecture in Android community is modularization with Clean Architecture. If you have time to invest more, I would strongly suggest Joe Birch's clean architecture tutorials. As Joe suggests in his tutorials, we do not have to apply every rule line by line but instead we take whatever we feel like is needed. Here is my take and how I modularized the All About Maps app:
Note that dependency injection with Dagger2 is the core of this implementation. If you are not familiar with the concept, I strongly suggest you to read the best Dagger2 tutorial in the wild Dagger2 world by Nimrod Dayan.
Domain Module
Many of us are excited to start implementation with UI to see the results immediately but we should patiently build our blocks. We shall start with the domain module since we will put our business logic and define the entities and user interactions there.
This is not the end. For full content, you can visit https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201260729166420263&fid=0101187876626530001

Related

Story Behind ScanScan: Huawei Developer Platforms Power Mobile App Accessibility

Tao Xinle is excited about the upcoming HUAWEI DEVELOPER CONFERENCE 2020 (Together), not only because he can share stories and thoughts with developers across the world at this annual event, but also because he will bring his new innovation to the HDC. It is a text recognition app called ScanScan that has been downloaded more than 9 million times in AppGallery.
ScanScan was born out of a romance. Three years ago, Tao quit his job in Beijing and moved to Yunnan Province to live with his girlfriend Baibai. As a book lover who enjoys reading and noting down her favorite sentences, she tried various types of OCR software but was frustrated by the complicated procedures, low precision, and high costs. Therefore, Tao decided to develop a handy OCR tool for her.
Tao used the white cat he raised with his girlfriend as the logo for ScanScan to symbolize their love and togetherness.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Story Behind ScanScan: Huawei Developer Platforms Power Mobile App Accessibility
Baibai giving feedback about ScanScan
As a beta user of ScanScan, Baibai offered a lot of useful feedback, which inspired Tao to add more functions to the original version, including document scanning, chart recognition, batch recognition, and translation.
During app development, Tao used the OCR and document correction capabilities powered by HUAWEI HiAI to improve the accuracy of text recognition and speed of boundary detection, and also integrated HMS Core's ML Kit, all free of charge. In addition to helping Tao save on resources, these two platforms also allowed the OCR feature to be compatible with various mobile phones, from low-end to high-end models, from Huawei brands to non-Huawei brands, even without the need to connect to a network.
The full-coverage capabilities provided by Huawei allow developers to develop features or apps compatible with all device models. ScanScan offers an offline recognition capability, which keeps user data safe with the recognized results stored locally on your phone, and allows users to use it anywhere, even in remote areas where the network signal is often patchy.
Story Behind ScanScan: Huawei Developer Platforms Power Mobile App Accessibility
Tao Xinle and Baibai trying out the app
At the very beginning, ScanScan aimed to offer more convenience to users like Baibai. However, it turned out to be a blessing for another unexpected group of users.
"ScanScan really helps me see the world," said Anzhi, a visually impaired user of the app. "I use it to read my schedule, musical notation, user guide for electronic device, and the label on medicine packets. Sometimes when I am not sure which floor I am on, ScanScan can help me identify the floor by taking a picture." Anzhi described her user experience with high praise for the app: "If I was only allowed to use one app on my phone, it would be ScanScan because it really helps me see more in my life."
By integrating HMS Core's AI capabilities and adapting to some accessibility functions on phones, ScanScan can easily recognize text in photos and convert it into audio output, which enables people with visual impairments to read in daily life. It also adds voice alerts to instruct users to adjust the camera angle for a more precise recognition result.
"When I found out that ScanScan can actually help people, it felt like I’ve done something worthwhile," said Tao.
Such powerful technology should be accessed by everyone, though it is sometimes still out of reach for certain groups. Accessibility features are crucial to apps, just like tactile paving is an indispensable part of our streets. By creating an app like ScanScan, Tao has demonstrated that he is as much of a pioneer as he is a developer who has paved the way for more newcomers.

Remixlive: Everyone Can Become a Musician

With the launch of the music creation app’s 5th iteration on AppGallery, developers from Remixlive worked together with Huawei engineers to integrate HMS Core. The developers are committed to offering both amateurs and professionals the possibility to create their own jam and make more complex music.
If you are a DJ or an aspiring one, you may be familiar with the experience of working on a full on Digital Audio Workstation (DAW). How about something that is way simpler to operate and lets you work on-the-go? Introducing Remixlive 5.
A digital DJ mixing software developed by the French company Mixvibes, Remixlive 5 lets you edit music samples everywhere and anywhere. You can produce a complete track on your phone almost instantly with the in-app grid-based remix toolbox. There is also a new Step Sequencer that allows anyone to create their own rhythmic and melodic sequences, making more complex music. Released in April 2020, Remixlive 5 is now available on AppGallery for all Huawei and Honor smartphone users.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
“In 1999, we founded Mixvibes because of our passion for music. There was no DJ software at that time,” said Eric Guez, CEO, Mixvibes. Dedicated to developing the best tools for music producers, the company decided to create Remixlive, a unique and versatile music-making application, after working on their flagship software Cross DJ.
Remixlive is made for DJs who want to deep-dive into music creation without spending hours learning how to use DJ software. After interviewing 20 DJs, the developers at Mixvibes concluded that music production apps on the market were either too simple in terms of features and functions or too complex in terms of the user experience. Thus, they decided to design an app which lets users get started easily, yet at the same time is capable of advanced music-making functionalities. With that, Remixlive was born.
“You can be a guitarist and use Remixlive as a backing track. Or you can be an MPC lover and make music by using our drums,” said Guez. “With each iteration, we aim to bring Remixlive closer towards being a mobile workstation for any musician on the road.”
Nordhal Mabire, Developer Leader​
Nordhal Mabire, the lead developer of Remixlive, realised the potential of Huawei HMS Core and started on HMS Core Kit integration to make the user experience better. So far, Remixlive has integrated with the Push Kit, IAP and Analytics Kit. Push Kit offers users the possibility to get notifications immediately when new sample packs are coming. Besides, thanks to the IAP payment method, Remixlive can get an audience who was not able to go further in music production.
Furthermore, the developers are very close to their users. This is a positive for Remixlive’s developers who can very quickly adapt to users’ changing and diverse needs. “With the help of App Services offered by HMS Core, we were able to integrate with the Analytics Kit, which allowed us to understand our users. With that, we could optimise the application for a better user experience,” Mabire said.
The Analytics Kit allows Remixlive to provide users with more personalised services. Remixlive’ s first version was only a simple app to create songs, but in the latest version, users can find a large variety of features, such as advanced sample editing, Step Sequencer, Instant FX pad, and so on. These features elevate Remixlive into a more professional-level app, and at the same time allows users to be more creative in music production.
“After the publication of the Remixlive application on AppGallery, we could better understand our Huawei users’ needs and meet their expectations and preferences.” Mabire added.
In fact, developing Remixlive for the AppGallery was not a bed of roses. Remixlive provides more than 150 sound packs to help music producers. Some of these packs were embedded in the app, and the developers used the android expansion file (OBB). With these files, users can choose if they’d like to download free content before scheduled app updates.
“The inconvenience here was the need for the users to go online when launching the Remixlive app, especially if the free content needed an update,” said Mabire. OBB integration was impossible when they first developed Remixlive for AppGallery. But they managed to configure the app build to get these packs directly from within the app. As a result, Remixlive Huawei smartphones users don’t have to go online when launching the app.
In April, Remixlive 5 was launched a few days before lockdowns around the world. During the time of the pandemic and lockdowns, people needed to think about positive things and music was the perfect subject. Users were happy with the updates brought by Remixlive 5, and its sales increased by 49% in recent months.
“Since integrating HMS Core for Remixlive was a great success, we want to extend kit integration of HMS Core to our other apps. We have already integrated HMS Core to Cross DJ Free, and Cross DJ Pro will be ready soon,” said Guez and Mabire. “We are also very interested in the new HMS Core 5.0. We believe it will help us to give a better and smoother user experience for music lovers.”
For details about Huawei developers and HMS, visit the website.
HUAWEI Developer Forum | HUAWEI Developer
forums.developer.huawei.com

Charting New Territory with Huawei Map Engine

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Maps are an integral part of life. Whether you’re going on an adventure hike, hailing a ride to get to work, trying to order food delivery from a nearby cafe, or just exploring a new neighbourhood you have just moved to, I bet the apps you’re using will always have a map and location function.
With a usage level this high, many Huawei developers need to integrate map-based functions when developing apps. This is exactly why HMS Core has included Map Kit, Site Kit and Location Kit as part of its Core Kits and capabilities.
Map Kit provides developers with basic capabilities such as map presentation, map interaction, route planning and supports various local lifestyle and transport businesses. Site Kit lets you provide users with convenient and secure access to diverse, place-related services. Location Kit combines the GPS, Wi-Fi, and base station location functionalities into an app to build up global positioning capabilities, allowing you to provide flexible location-based services targeted at users around the globe.
To launch these services that bring conveniences to users and developers alike, Huawei formed a map team. Right at the start, the team only consisted of 20 to 30 people and very few of whom had any formal training in the map industry.
Looking back on those early days, we were really flying blind. But as time went by, the team gradually filled out with new blood and included several fantastic industry experts. Each expert who joined the team was provided with a full suite of helpers to allow them to assimilate quicker onto the project so they can bring more value to the team. Many of these newcomers have grown a great deal since joining and, through a lot of hard work and a pioneering attitude, each has become a key pillar of our team’s success in their own right. We always used to joke that “the early bird catches the ***” … but he also must work the hardest.
Following the advice of our expert team members, we gradually formed a pyramid based on technical ability while maintaining a flat management structure. This enhanced the entire team’s development, deployment, analysis and problem-solving capabilities.
Now, Huawei Map Engine provides comprehensive location and mapping tools in 200 different regions and countries. Our map rendering has been enhanced by over 30% and key location indicators improved by over 20%, allowing us to surpass our initial goals in terms of performance. The service provides reliable and efficient location and mapping for app developers, supporting the worldwide expansion of the entire HMS Core ecosystem.
Throughout the development process, the team has adopted a variety of excellent new accessibility practices. For example, by proposing an integrated SDK decoupling cloud server, we were able to provide complete access to Map Kit and Location Kit to one of Singapore’s leading taxi apps ComfortDelGro in just three weeks.
Mapping and location services are a constantly evolving sector. It might be helpful to think of it like a living organism, with an algorithm engine as the brains, map data as the heart and the map ecosystem as the lifeblood. In the near future, Huawei will be able to perfect this comprehensive mapping ecosystem by combining those kits with a new app and data platform.
The new ecosystem will also introduce new algorithms and business models, such as AR maps, visual location and navigation services, AI-powered data generation, high-precision geo-positioning and other new technologies that will help to determine the future trajectory of the industry. At the same time, machine learning from accumulated data will help improve the accuracy and performance of existing algorithms and ultimately provide users with a better experience.
As always, the future is full of challenges and uncertainties. But watch this space, because our entire mapping team is confident of tackling this challenge head-on and creating a more competitive array of location services for our users.
*The article is written by HUAWEI’s Map expert.
For details about Huawei developers and HMS, visit the website.
HUAWEI Developer Forum | HUAWEI Developer
forums.developer.huawei.com

Huawei Mobile Services delivers next-level success for Wongnai and Line Man on AppGallery

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2020 was a roaring year for the food delivery sector – the already thriving industry was boosted by an increasingly digital population that had no other means to enjoy their favourite dish due to social distancing measures. According to Sensor Tower, these factors contributed to a huge 21% year-on-year growth of 1.7 billion food and drink category apps installs globally in 2020.
However, competition within this sector also intensified last year as new companies looked to stake their claim in the growing market. In order to do this, food apps need to be able to compete with the top dogs on all fronts to ensure they are equally effective at acquiring and retaining users. For many, the answer was evident – develop a more intuitive, powerful, and enjoyable app experience. Given the industry offers little space for differentiation in terms of services, companies are dependent on driving a superior user experience to build their brand loyalty.
This set of challenge holds true for two apps in Thailand – Delivery platform Line Man as well as its lifestyle services review platform partner Wongnai. Line Man was looking to expand in 2020 but the lack of robust map service features and location tracking capabilities severely hamper its ability to achieve that goal. Similarly, Wongnai’s lacklustre location tracking capability and platform manipulation issue was affecting its standing among users during a pivotal period.
Step in Huawei. The partners sought out Huawei for guidance to address their respective issues for their apps on AppGallery. The discussion then evolved to a collaboration with Huawei where the two developers integrated the open HMS (Huawei Mobile Services) Core capabilities, and were able to successfully eradicate their roadblocks and unleash better location and tracking capabilities.
Triangulating users’ locations swiftly, accurately and clearly
Wongnai, as a leading lifestyle services review platform, needed to accurately pinpoint users’ location to recommend relevant nearby shops and attractions. By integrating with the HMS Core Location Kit, Wongnai was able to leverage the kit’s Global Navigation Satellite System (GNSS), Wi-Fi, and base station location functionalities to provide flexible location-based services. This allows it to make dynamic, relevant recommendations for its users.
Line Man was facing a similar situation as well – it needed to constantly provide users with the location of their food and delivery riders to provide the most optimal ordering experience. Not only does the integration with Location kit achieve this, it also enables advanced features such as geofencing and activity identification. These capabilities enable the app to share reliable updates on the status of the order unceasingly, building goodwill and positive word-of-mouth among customers.
Displaying a map that is not only relevant but intuitive
Given that both services are heavily reliant on users’ location, the developers also needed a map service that can be customised according to their needs and is capable to convey all the relevant information effectively. In consideration of this, Wongnai and Line Man chose to integrate HUAWEI Map Kit with their respective apps as well.
With Map Kit, apps can leverage Huawei’s powerful map service and route planning capabilities to provide an elevated app experience for the users. The two developers were able to introduce an assortment of map functions based on their respective userbase’s unique needs. As a result, the users are able to effortlessly identify the various participating restaurants and businesses in one simple glance, improving the overall user experience.
Huawei and HMS Core drive success for their partners
The partnership with Huawei was a resounding success for the developers, both commercially and operationally. The integration with HMS Core not only propelled both apps past the two million downloads milestone, but it also helped Line Man boost its daily user figures by three-fold in the first two months.
Huawei is acutely aware of the different operational challenges facing developers, including the cost associated with launching apps across multiple distribution platforms. As part of its commitment to developers, Huawei provides developers with free access to certain HMS Core Kits to help alleviate the operational cost. Furthermore, HMS Core offers a unique function that can identify whether a device supports Huawei Mobile Service, allowing the app to call upon the corresponding SDK. This essentially meant that developers only need to maintain one app, reducing the time spent in terms of deployment and testing, as well as the operational costs associated with these activities.
In addition, Huawei extends its support for developers across the entire operation management spectrum, including marketing efforts. Wongnai and Line Man collaborated with AppGallery on a week-long campaign last year where users were able to redeem HUAWEI points through purchases in-app. The campaign was particularly effective for Wongnai who saw its new user download figures skyrocket 10-fold. The campaign boosted the apps’ visibility among AppGallery users, leading to a significant increase in daily downloads even after the campaign ended.
Another notable feat from this collaboration is the time it took to complete the entire integration process, especially in the case of Wongnai. The developer implemented three other HMS Core kits – Site Kit, Safety Detect, and Push Kit – on top of the two examples discussed above, and despite the mountainous amount of technical work that comes with it, the team was able to successfully incorporate the five kits into their app in just three weeks. This achievement was made possible through an intimate collaboration with Huawei’s developer support team, who offered extensive support as well as technical insights to facilitate the development process.

Principles Behind HUAWEI Prediction How We Trained Models for the Service

HUAWEI Prediction utilizes machine learning, based on user behavior and attributes reported by HUAWEI Analytics Kit, to predict target audiences with next-level precision. The service can help you with carrying out and optimizing operations. For example, it can work with A/B Testing to evaluate how effective your promotions have been and it can also join hands with Remote Configuration to configure dedicated plans for specific audiences through Remote Configuration. This is likely to result in dramatically improved user retention and conversion.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Integrating the Analytics SDK into your app enables the Prediction service to run preset tasks for predicting lost, paying, and returning users. On the details page of a specific prediction task, you'll find audiences with high, medium, and low probabilities of triggering a specific event, with meticulous profiling. For example, an audience with a high churn probability will include users who are very likely to quit using the app over the next 7 days. The characteristics of these users are displayed on cards, which makes it easy for you to pursue targeted operations.
The following figures give you a sense of how the prediction task list and details page look in practice.
* Data in these figures is for reference only.
Ø How we built these prediction models
First of all, we made it clear what our goal was to make predictions, so the type of data we collect reflects this. We then cleansed and sampled the collected data based on user characteristics to obtain a data set. This data set was divided into a 20% validation set and an 80% training set; multiple rounds of offline experiments were then conducted to determine the features and most suitable parameters for forming models. The generated models were later trained online to perform prediction tasks.
This process is outlined in detail below:
Ø Feature and model selection and optimization
Feature exploration
At the early stage of the project, we made sure to analyze user attributes, behavior, and requirements, in order to determine the business-relevant variables, such as user active days over the last 7 days and app use durations, through which we built a feature table.
After the features were identified, we chose a method that best suited our service and optimized parameters by performing multiple rounds of experiments. Common tree boosting methods that can be found across the industry include XGBoost, random forests, and Gradient Boost Decision Tree (GBDT). We trained our data set using these methods, and found that random forests perform best. Then the bagging method was adopted to improve models' fitting and generalization capabilities.
In addition to parameter optimization, the sampling ratio was also considered, especially for the payment prediction scenario, in which the proportion between positive samples and negative samples was large (about 1:100). For such cases, the accuracy and recall indicators should both be ensured. Then we adjusted the ratio of positive samples to negative samples to 1.5:1 during model training for payment prediction, in order to boost the recall of the model.
Hyperparameter and feature determination
Unnecessary features in a model can undermine the efficacy of predictions made by the model, or slow down model training. During experiments at this early stage, features were sorted by weight, and the top features were selected. In the model that would actually come to be, these features and relevant hyperparameters were configured.
Even after a model is applied for prediction, the data still needs to be observed and analyzed to supplement necessary features. In later iterations, we added a range of features, including the event and trend features, bringing the feature count over 400.
Automatic hyperparameter search
Model training involving full features can be quite time-consuming, and fail to produce the optimal output. In addition, the optimal hyperparameters and features may vary depending on the app. Therefore, the training should be performed by app.
To address this issue, we applied the automatic hyperparameter search function to search for optimal parameters in the configured parameter space. Matched parameters are stored in a Hive table.
The following figures show the modeling procedure and relevant external support.
Ø Research emphasis
We will continue optimizing our models, by researching the following:
l Neural network
As the number of features continues to grow (400+ currently), and user behaviors become too complex to mine common rules, our prediction models will need to be enhanced to ensure that predictions remain accurate. This will require that we introduce neural networks with strong expressive power, in addition to decision trees to train models based on behavioral features.
l Federated learning
Currently, data is isolated between apps and tenants. Horizontal federated learning can be used to train models across apps and tenants on a collaborative basis.
l Time series feature
A typical app user's device will report hundreds of events (among 1,000+ event types) and access nearly 100 pages within the app on a weekly basis. These times series can be used to build both short- and long-term user behavioral features, with the goal of improving prediction accuracy across a wide range of scenarios. Page access user behavioral data can be valuable for research, as such data bear characteristics of time series data.
l Feature mining and processing
The feature set is still being expanded. We will explore additional relevant features, such as the average app use interval, device attributes, download sources, and locations. In addition, we will also undertake such measures as discretization, normalization, square and square root operations, Cartesian product calculation, and Cartesian product calculation for multiple data sets, to build subsequent features that are based on existing features.
For more on HUAWEI Prediction, visit>>
For more details, you can go to:
l Our official website
l Our Development Documentation page, to find the documents you need
l Reddit to join our developer discussion
l GitHub to download demos and sample codes
l Stack Overflow to solve any integration problems

Categories

Resources