1602915540

# Mean Average Precision (mAP) Explained

To evaluate object detection models like R-CNN and YOLO, the mean average precision (mAP) is used. The mAP compares the ground-truth bounding box to the detected box and returns a score. The higher the score, the more accurate the model is in its detections.

In my last article we looked in detail at the confusion matrix, model accuracy, precision, and recall. We used the Scikit-learn library to calculate these metrics as well. Now we’ll extend our discussion to see how precision and recall are used to calculate the mAP.

Here are the sections covered in this tutorial:

• From Prediction Score to Class Label
• Precision-Recall Curve
• Average Precision (AP)
• Intersection over Union (IoU)
• Mean Average Precision (mAP) for Object Detection

Let’s get started.

### From Prediction Score to Class Label

In this section we’ll do a quick review of how a class label is derived from a prediction score.

Given that there are two classes, Positive and Negative, here are the ground-truth labels of 10 samples.

``````y_true = ["positive", "negative", "negative", "positive", "positive", "positive", "negative", "positive", "negative", "positive"]
``````

When these samples are fed to the model it returns the following prediction scores. Based on these scores, how do we classify the samples (i.e. assign a class label to each sample)?

``````pred_scores = [0.7, 0.3, 0.5, 0.6, 0.55, 0.9, 0.4, 0.2, 0.4, 0.3]
``````

To convert the scores into a class label, a threshold is used. When the score is equal to or above the threshold, the sample is classified as one class. Otherwise, it is classified as the other class. Let’s agree that a sample is Positive if its score is above or equal to the threshold. Otherwise, it is Negative. The next block of code converts the scores into class labels with a threshold of 0.5.

``````import numpy

pred_scores = [0.7, 0.3, 0.5, 0.6, 0.55, 0.9, 0.4, 0.2, 0.4, 0.3]
y_true = ["positive", "negative", "negative", "positive", "positive", "positive", "negative", "positive", "negative", "positive"]

threshold = 0.5
y_pred = ["positive" if score >= threshold else "negative" for score in pred_scores]
print(y_pred)
['positive', 'negative', 'positive', 'positive', 'positive', 'positive', 'negative', 'negative', 'negative', 'negative']
``````

Now both the ground-truth and predicted labels are available in the `y_true` and `y_pred` variables. Based on these labels, the confusion matrix, precision, and recall can be calculated.

``````r = numpy.flip(sklearn.metrics.confusion_matrix(y_true, y_pred))
print(r)

precision = sklearn.metrics.precision_score(y_true=y_true, y_pred=y_pred, pos_label="positive")
print(precision)

recall = sklearn.metrics.recall_score(y_true=y_true, y_pred=y_pred, pos_label="positive")
print(recall)
## Confusion Matrix (From Left to Right & Top to Bottom: True Positive, False Negative, False Positive, True Negative)
[[4 2]
[1 3]]

## Precision = 4/(4+1)
0.8

## Recall = 4/(4+2)
0.6666666666666666
``````

After this quick review of calculating the precision and recall, in the next section we’ll discuss creating the precision-recall curve.

### Precision-Recall Curve

From the definition of both the precision and recall given in Part 1, remember that the higher the precision, the more confident the model is when it classifies a sample as Positive. The higher the recall, the more positive samples the model correctly classified as Positive.

When a model has high recall but low precision, then the model classifies most of the positive samples correctly but it has many false positives (i.e. classifies many Negative samples as Positive). When a model has high precision but low recall, then the model is accurate when it classifies a sample as Positive but it may classify only some of the positive samples.

Due to the importance of both precision and recall, there is a precision-recall curve the shows the tradeoff between the precision and recall values for different thresholds. This curve helps to select the best threshold to maximize both metrics.

There are some inputs needed to create the precision-recall curve:

1. The ground-truth labels.
2. The prediction scores of the samples.
3. Some thresholds to convert the prediction scores into class labels.

The next block of code creates the `y_true` list to hold the ground-truth labels, the `pred_scores` list for the prediction scores, and finally the `thresholds` list for different threshold values.

``````import numpy

y_true = ["positive", "negative", "negative", "positive", "positive", "positive", "negative", "positive", "negative", "positive", "positive", "positive", "positive", "negative", "negative", "negative"]

pred_scores = [0.7, 0.3, 0.5, 0.6, 0.55, 0.9, 0.4, 0.2, 0.4, 0.3, 0.7, 0.5, 0.8, 0.2, 0.3, 0.35]

thresholds = numpy.arange(start=0.2, stop=0.7, step=0.05)
``````

Here are the thresholds saved in the `thresholds` list. Because there are 10 thresholds, 10 values for precision and recall will be created.

``````[0.2,
0.25,
0.3,
0.35,
0.4,
0.45,
0.5,
0.55,
0.6,
0.65]
``````

The next function named `precision_recall_curve()` accepts the ground-truth labels, prediction scores, and thresholds. It returns two equal-length lists representing the precision and recall values.

``````import sklearn.metrics

def precision_recall_curve(y_true, pred_scores, thresholds):
precisions = []
recalls = []

for threshold in thresholds:
y_pred = ["positive" if score >= threshold else "negative" for score in pred_scores]

precision = sklearn.metrics.precision_score(y_true=y_true, y_pred=y_pred, pos_label="positive")
recall = sklearn.metrics.recall_score(y_true=y_true, y_pred=y_pred, pos_label="positive")

precisions.append(precision)
recalls.append(recall)

return precisions, recalls
``````

The next code calls the `precision_recall_curve()` function after passing the three previously prepared lists. It returns the `precisions` and `recalls` lists that hold all the values of the precisions and recalls, respectively.

``````precisions, recalls = precision_recall_curve(y_true=y_true,
pred_scores=pred_scores,
thresholds=thresholds)
``````

Here are the returned values in the `precisions` list.

``````[0.5625,
0.5714285714285714,
0.5714285714285714,
0.6363636363636364,
0.7,
0.875,
0.875,
1.0,
1.0,
1.0]
``````

Here is the list of values in the `recalls` list.

``````[1.0,
0.8888888888888888,
0.8888888888888888,
0.7777777777777778,
0.7777777777777778,
0.7777777777777778,
0.7777777777777778,
0.6666666666666666,
0.5555555555555556,
0.4444444444444444]
``````

Given the two lists of equal lengths, it is possible to plot their values in a 2D plot as shown below.

``````matplotlib.pyplot.plot(recalls, precisions, linewidth=4, color="red")
matplotlib.pyplot.xlabel("Recall", fontsize=12, fontweight='bold')
matplotlib.pyplot.ylabel("Precision", fontsize=12, fontweight='bold')
matplotlib.pyplot.title("Precision-Recall Curve", fontsize=15, fontweight="bold")
matplotlib.pyplot.show()
``````

The precision-recall curve is shown in the next figure. Note that as the recall increases, the precision decreases. The reason is that when the number of positive samples increases (high recall), the accuracy of classifying each sample correctly decreases (low precision). This is expected, as the model is more likely to fail when there are many samples.

The precision-recall curve makes it easy to decide the point where both the precision and recall are high. According to the previous figure, the best point is `(recall, precision)=(0.778, 0.875)`.

Graphically deciding the best values for both the precision and recall might work using the previous figure because the curve is not complex. A better way is to use a metric called the `f1` score, which is calculated according to the next equation.

The `f1` metric measures the balance between precision and recall. When the value of `f1` is high, this means both the precision and recall are high. A lower `f1` score means a greater imbalance between precision and recall.

According to the previous example, the `f1` is calculated according to the code below. According to the values in the `f1` list, the highest score is `0.82352941`. It is the 6th element in the list (i.e. index 5). The 6th elements in the `recalls` and `precisions` lists are `0.778` and `0.875`, respectively. The corresponding threshold value is `0.45`.

``````f1 = 2 * ((numpy.array(precisions) * numpy.array(recalls)) / (numpy.array(precisions) + numpy.array(recalls)))
[0.72,
0.69565217,
0.69565217,
0.7,
0.73684211,
0.82352941,
0.82352941,
0.8,
0.71428571, 0
.61538462]
``````

The next figure shows, in blue, the location of the point that corresponds to the best balance between the recall and the precision. In conclusion, the best threshold to balance the precision and recall is `0.45` at which the precision is `0.875` and the recall is `0.778`.

``````matplotlib.pyplot.plot(recalls, precisions, linewidth=4, color="red", zorder=0)
matplotlib.pyplot.scatter(recalls[5], precisions[5], zorder=1, linewidth=6)

matplotlib.pyplot.xlabel("Recall", fontsize=12, fontweight='bold')
matplotlib.pyplot.ylabel("Precision", fontsize=12, fontweight='bold')
matplotlib.pyplot.title("Precision-Recall Curve", fontsize=15, fontweight="bold")
matplotlib.pyplot.show()
``````

After the precision-recall curve is discussed, the next section discusses how to calculate the average precision.

#deep-learning #data-science #developer

1595334123

## Authentication In MEAN Stack - A Quick Guide

I consider myself an active StackOverflow user, despite my activity tends to vary depending on my daily workload. I enjoy answering questions with angular tag and I always try to create some working example to prove correctness of my answers.

To create angular demo I usually use either plunker or stackblitz or even jsfiddle. I like all of them but when I run into some errors I want to have a little bit more usable tool to undestand what’s going on.

Many people who ask questions on stackoverflow don’t want to isolate the problem and prepare minimal reproduction so they usually post all code to their questions on SO. They also tend to be not accurate and make a lot of mistakes in template syntax. To not waste a lot of time investigating where the error comes from I tried to create a tool that will help me to quickly find what causes the problem.

``````Angular demo runner
Online angular editor for building demo.
ng-run.com
<>
``````

Let me show what I mean…

### Template parser errors#

There are template parser errors that can be easy catched by stackblitz

It gives me some information but I want the error to be highlighted

#mean stack #angular 6 passport authentication #authentication in mean stack #full stack authentication #mean stack example application #mean stack login and registration angular 8 #mean stack login and registration angular 9 #mean stack tutorial #mean stack tutorial 2019 #passport.js

1596094635

## What Is MEAN STACK and Scope of MEAN STACK Developer ?

What is MEAN Stack Developer?
MEAN Stack Developer is a programmer who operates on the MEAN stack. He works on the backend plus the front end of the application. They are all JavaScript based and therefore a MEAN developer should have excellent JS knowledge, for which you can join MEAN Stack Online Training Program.

Skillets of MEAN Stack developer
• Knowledge of working on the Front-end and Back-end processes
• Work with HTML & CSS
• Understanding of programming templates and architecture design guidelines
• Knowledge of continuous integration, web development, and cloud technologies
• Excellent understanding of DB architecture
• Knowledge of SDLC and experience developing in an Agile environment
• Collaborate with the IT team to build robust systems to support business objectives
• Hands-on experience on Mongo, Angular, Express, Node.
Future of MEAN stack Developer

Being, a Mean stack developer is a highly desirable, challenging vocation. So, if you are ready to work on the diverse skill set and have the experience of working with various code languages and application, then you will become successful MEAN stack developer.

Scope of MEAN stack developer

MEAN Stack Development is the best career prospect today with unlimited growth and scope. The national Indian median salary was around 76K \$ pa according to Glassdoor.com. All you need to do is get cracking on your skill set by joining MEAN Stack course in Delhi, earn your certification and through your job experience and continued experiential learning keep pace with newer iterations in technology.
Developers are available in various process streams like Backend, Frontend, Database, Testing, and Mobile Apps. Older practices were that as you gain experience and expertise you would pursue specialization and progress your career in that direction.
How Can I Start Learning Mean Stack Course Step By Step? Modern best practices have changed the trend.
Skill upgrades and building proficiency in:
• CSS
• HTML
• JavaScript
• Ruby, PHP, or Python which are all-purpose languages.
• Postgres, Oracle, or MySQL, relational-database systems.
• Any web-server which includes Nginx or Apache
• FreeBSD, Ubuntu, or CentOS deployment OS.
• Any system for instance GIT for version-control

By mastering one software technology required for every stack-part you will be in a position to create your own software and use it to add business value at your job.

#mean stack #mean stack training #mean stack certification online #mean stack online course #mean stack online training

1623221809

## Maplytics - Dynamics 365 CRM and Bing Maps Integration

Maplytics™ is an advanced mapping and data visualization tool for Microsoft Dynamics 365 CRM. It provides Territory Management, Appointment Planning, Routing, Radius Search and much more with support for PowerApps (CDS). Maplytics supports all Dynamics 365 deployment models for Dynamics CRM 2011 and above as well as native Dynamics 365 App for Phones and Tablets.
Below are the features you can avail with Maplytics
• Sales Territory Management: Geographically manage and align sales territories, perform binary operations on shapes, regions or territories on map. Assign multiple territories to a record.
• Auto Scheduling: Create an automated optimized schedule for multiple days on field including routes to follow each day based on details entered by user and also create activities for the same
• Check-In/Check-Out: Enable Check-In/Check-Out for field reps on site of visit with the option of Geofencing
• PCF control: User can add components on fields or grids within Dynamics CRM to view the respective records on the map within the record form or the entity grid
• Overlay: View records, shape files and existing territories together on map. View Census Data as existing Overlay feature.
• Proximity Search: Search records for a location based on radius or time with shortest travel and line of sight distance.
• Route Optimization: Optimize routes, find nearby records along the route and points of interest like Coffee Shops, Gas station, etc.
• Customizable Pushpins & Tooltip Cards: Plot desired icons for pushpins for seamless visual analysis. Call to action buttons on Tooltip cards for quick actions.
• Security template: System admin and Maplytics admin can provide selective access of actions to users
• Marketing Management: Create geographically targeted Marketing Lists for personalized and relevant promotions, marketing campaigns and events
• Mass Actions: Add to Route, Save Data, Schedule Appointments, Send Emails and more for records plotted on map
• Summary Card: Get aggregated information for enclosed area on map for quick analysis
• Mobility: Use native Dynamics 365 App for Phones and Tablets to get locational insights
• Heat Map Visualization: Analyze density of CRM data on map for insights through pie/column charts
• Real-Time Tracking: Managers can now track the location of Field Service Reps when on field in real time within Dynamics 365 Field service.
• Land Area Mapping: Define the area of land as agricultural, residential, commercial properties and visualize the same on the map.
• Territory Assignment Rule: Maplytics Admins and Managers can create simple/advanced rules based on which territories will be assigned to the records as per the required conditions.

#maps #bing #maps #map #dyynamics #65crm

1611556117

## What is Maps.me (MAPS) | What is Maps.me token | What is MAPS token

Maps.me 2.0 aims to be the ultimate travel companion and your passport to the new financial system. Powered by Serum and running on the fast and scalable Solana blockchain, Maps.me and its 140mm users represent a one-in-a-kind opportunity to accelerate the worldwide adoption of DeFi. MAPS tokens will bind Maps.me’s users and provide familiar travel reward programs and discounts, as well as governance features on certain aspects of ecosystem.

Maps.me 2.0 has both online and offline maps while offering DeFi functionalities to its 100M+ users.

Powering Maps.me 2.0 is the MAPS token which may provide token holders with 100% of the platform’s net revenues.

Token-holders using the app will also benefit from personalized promotions and rewards, likely driving adoption, retention, and virality of MAPS within the community. There are very few apps with a user base as large as ours, so Maps.me is positioned to quickly put DeFi financial services in the hands of many.

Furthermore, users utilize our app throughout their entire journey/travel process: we can therefore develop a travel- and wallet-oriented ecosystem to instill new user habits with regards to,

• Payments
• Accommodation booking
• Fund transfers
• Asset management

Our offered financial services are decentralized, which contrasts with the centralized nature of Robinhood (brokerage), Paypal (payments), and Revolut (fintech banking).

Maps.me is a popular mapping application that works similar to Google Maps except users can access it offline. But why is it relevant to crypto? Maps 2.0 introduces new financial products and services on the platform, allowing users to store assets, convert currencies, transfer funds, and make payments digitally.

Decentralized finance (DeFi) has enabled a new wave of innovations on the blockchain. It has helped expand the use cases for digital assets since it allows integration with any platform. And Maps is one of the biggest applications today that have transitioned to adopt DeFi technology.

Maps is a travel and navigation application that allows users to access maps both online and offline. Lately, Maps has introduced new digital finance features built on the  Solana blockchain. With a remarkable user base actively using the platform, it can become a springboard for greater DeFi adoption.

### Background

Maps.me is an application owned by the Mail.ru group, a leading internet business firm based in Russia, which is also backed by other prominent firms like Alibaba, Naspers, and Tencent. With the aim of maximizing the application and tapping on its growing user base, the team behind the project worked on introducing DeFi features on the platform.

Maps has also been working closely with Alameda Research and FTX Exchange’s Sam Bankman-Fried, who also happens to be one of the advisors for  Oxygen protocol, a Solana-based exchange. In order to help bring liquidity to Oxygen, Maps is hoping to make them work together to be able to tap Map’s rich user base.

### What is Maps.me?

Maps.me is a mapping application that users can access offline. It functions almost similarly with Google Maps, only that Maps.me can work without internet access. Across the world, the platform has recorded over 140 million users utilizing it for their travel needs, as well as an aid for directions.

Maps 2.0 introduces new financial products and services on the platform. Through this upgrade, users can finally store assets, perform currency exchange, transfer money, and make payments digitally. One of its biggest additions includes the integration of DeFi on Maps 2.0.

Maps’s digital wallet can facilitate peer-to-peer transactions. This means that it does not need any intermediary to conduct the exchange between users worldwide, making it a more affordable and censorship-resistant platform for remittances and cross-border payments.

If you are a business owner, you also will not need to list your property on third-party websites or applications, which can be expensive for the owners, as well as the consumers. With Maps as the all-in-one platform, users can finally make direct bookings and payments without leaving the application. In addition, businesses can benefit from doing away with intermediaries and the extra costs that come with them.

Besides the DeFi services that will be made available to the updated Maps platform, the project will also be partnering with local businesses to promote both their needs as well as their users. This ecosystem is expected to create a richer use case with personalized promotions, loyalty programs, branded content integrated within the map, and the opportunity to claim a business and increase its visibility with utmost convenience.

The economic model of Maps 2.0 will be built on top of the Solana blockchain and powered by the Serum protocol. This enables network attributes like faster transaction settlement times, low transaction fees, network security, and composability. Furthermore, the platform will also introduce a native token called MAPS, which would enable the platform to reward its users and holders for their app usage. In addition, the holders of the token will be given 100% of the net revenue that the platform makes.

Along with the token, Maps 2.0 will integrate a digital wallet, which can be used to store the users’ cryptocurrencies or other supported assets, conduct money transfers worldwide, and trade between the platform’s supported assets.

Developers of the platform will benefit from Maps 2.0’s deployment on the Solana blockchain as one of its biggest attributes is ‘composability.’ Anyone can build on the applications that are already on the platform. Devs can also make improvements from Maps 2.0, as well as create new protocols that complement those that already exist.

### MAPS Token

As already mentioned, MAPS token enables a reward system designed to benefit its holders and app users. They can earn from privacy-preserving, personalized promotions too, helping the application cultivate its user base long-term. This token can also be used as a medium of exchange on the platform.

To ensure the sustainability of the platform’s growth, it follows a deflationary token model. There are only 10,000,000,000 MAPS tokens in existence, and no more will be minted in the future. Its total supply will also continuously decrease over time as the tokens that are bought back are burned.

Anyone can purchase MAPS tokens, except those who live in the United States, China, or other countries where it is prohibited.

#### How Does the Platform Generate Revenue?

MAPS holders will be able to earn their share of the revenue from services provided by the platform. These include revenue out of trading fees, fees from credit card transactions, fees from currency conversions, advertising fees, referral commissions, and many other products.

#### Other Benefits to Holding MAPS?

First off, frequent users of the application and those who promote listed locations on the platform earn MAPS tokens as a reward. Holders also enjoy lower fees and higher rewards from products and services available on the platform.

Another benefit of holding the native token is the opportunity to take part in the governance mechanism for the platform. This voting function allows users to take control of the application, especially on matters concerning upgrades, amendments to the reward structure and adding or modifying products and services, among others.

Business owners who also hold MAPS earn benefits from it as well. For one, holding the token will help them achieve better visibility as their locations are highlighted to users of the platform. This also means that they can be categorized into ‘premium listings,’ which gives them a good position in user searches.

### Sam Bankman-Fried and Maps 2.0

With Maps’s collaboration with Sam Bankman-Fried, the pioneer of the Serum Project, FTX Exchange and the founder of Alameda Research, as one of their consultants, users can expect a platform developed to fit what anyone would need in a DeFi platform.

Maps has also been reportedly working on linking the application to the Oxygen protocol for their brokerage and exchange needs. As one of the newly developed exchanges in the DeFi space, Oxygen can substantially benefit from this partnership as they will be able to access a body of users that Maps has amassed.

Total Supply: 10,000,000,000 MAPS

Initial circulating supply: Up to 300,000,000 MAPS

Token Distribution

Private sale: 5%
Public Sale and initial liquidity: 5%
Serum community fund: 20%
MAPS community fund: 20%
Liquidity & token growth: 5%
Ecosystem partners: 10%
Project builders: 15%
Technology & product: 10%
Ecosystem growth & marketing: 10%

Token Vesting Schedule

Public Sale and initial liquidity: Unlocked
Locked tokens are fully locked for the first year from token genesis, and then unlock linearly over the six years following.

##### How and Where to Buy Maps.me (MAPS)?

MAPS is now live on the Ethereum mainnet. The token address for MAPS is 0x2b915b505c017abb1547aa5ab355fbe69865cc6d. Be cautious not to purchase any other token with a smart contract different from this one (as this can be easily faked). We strongly advise to be vigilant and stay safe throughout the launch. Don’t let the excitement get the best of you.

Just be sure you have enough ETH in your wallet to cover the transaction fees.

You will have to first buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT), Binance (BNB)…

We will use Binance Exchange here as it is one of the largest crypto exchanges that accept fiat deposits.

Once you finished the KYC process. You will be asked to add a payment method. Here you can either choose to provide a credit/debit card or use a bank transfer, and buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT), Binance (BNB)…

Step by Step Guide : What is Binance | How to Create an account on Binance (Updated 2021)

Next step

You need a wallet address to Connect to Uniswap Decentralized Exchange, we use Metamask wallet

If you don’t have a Metamask wallet, read this article and follow the steps
What is Metamask wallet | How to Create a wallet and Use

Next step

Contract: 0x2b915b505c017abb1547aa5ab355fbe69865cc6d

The top exchange for trading in MAPS token is currently FTX, Bithumb, CoinBene, Gate.io, and Uniswap (V2)

Apart from the exchange(s) above, there are a few popular crypto exchanges where they have decent daily trading volumes and a huge user base. This will ensure you will be able to sell your coins at any time and the fees will usually be lower. It is suggested that you also register on these exchanges since once MAPS gets listed there it will attract a large amount of trading volumes from the users there, that means you will be having some great trading opportunities!

https://www.binance.com
https://www.bittrex.com
https://www.poloniex.com
https://www.bitfinex.com
https://www.huobi.com
https://www.mxc.ai
https://www.probit.com
https://www.gate.io
https://www.coinbase.com

🔺DISCLAIMER: The Information in the post is my OPINION and not financial advice, is intended FOR GENERAL INFORMATION PURPOSES ONLY. Trading Cryptocurrency is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money.

🔥 If you’re a beginner. I believe the article below will be useful to you