<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Weichen Huang</title><description>Research on intelligence, representations, and the connections between minds and machines.</description><link>https://weichen-huang.github.io/</link><language>en</language><item><title>Featured; Perfect numbers</title><link>https://weichen-huang.github.io/writing/perfectnumbers/</link><guid isPermaLink="true">https://weichen-huang.github.io/writing/perfectnumbers/</guid><description>A number that is equal to the sum of its divisors</description><pubDate>Thu, 16 Jun 2022 00:00:00 GMT</pubDate><content:encoded>## Introduction

I recently came across perfect numbers in a coding challenge and the topic fascinated me. So I thought to dedicate a blog to these perfect numbers.

A *perfect number* is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3 (excluding itself), and 1 + 2 + 3 = 6, so 6 is a perfect number.

The Euclid–Euler theorem is a theorem in number theory that relates perfect numbers to Mersenne primes. It states that an even number is perfect if and only if it has the form $$2^{p−1} * (2p − 1)$$, where $$2p − 1$$ is a prime number. The theorem is named after mathematicians Euclid and Leonhard Euler, who respectively proved the &quot;if&quot; and &quot;only if&quot; aspects of the theorem.

## Sufficiency proof

- $$2^p - 1$$ is prime
- $$σ(2^{p - 1}(2^p - 1)) = σ(2^{p - 1})σ(2^p - 1)$$
- The divisors of $$2^{p - 1}$$ are 1, 2, 4, 8, …, $$2^{p-1}$$ form a geometric series that sum to $$2^p - 1$$. 
- Since $$2^p - 1$$ is prime, it has 2 divisors: $$2^p - 1$$, $$1$$. The sum of the divisors is $$2^p$$
- $$σ(2^{p - 1}(2^p - 1) = σ(2^{p - 1})σ(2^p - 1) = (2^p - 1)(2^p) = 2(2^{p - 1})(2^p - 1)$$
- Therefore, $$2^{p - 1}(2^p - 1)$$ is perfect.

## Necessity Proof

- Suppose an even perfect number is given, and partially factor it as $$2^(k)x = σ(2^(k)x) = (2^{k + 1} - 1)σ(x)$$ (1)
- The odd factor on the right, $$2^{k + 1} - 1$$ is at least 3 and must divide $$x$$, the only odd factor on the left side -&gt; $$y = x / 2(2^{k + 1} - 1)$$ is a proper divisor of $$x$$
- Dividing both sides of (1) by common factor $$2^{k + 1} - 1$$ and taking into account known divisors $$x$$, $$y$$ of $$x$$ -&gt; $$2^{k + 1}y = σ(x) = x + y + … = 2^{k + 1}y + …$$
Therefore, there cannot be other divisors, $$y = 1$$, and $$x$$ must be prime of the form $$2^{k + 1} - 1$$.</content:encoded></item><item><title>A potpourri of programming and math</title><link>https://weichen-huang.github.io/writing/problems/</link><guid isPermaLink="true">https://weichen-huang.github.io/writing/problems/</guid><description>Some cool problems that I have analysed</description><pubDate>Wed, 15 Jun 2022 00:00:00 GMT</pubDate><content:encoded>I have compiled a list of in-depth analysis notes for problems in math and competitve programming:

[math](/notes/mathproblems.html)
[codeforces](/notes/codeforcesproblems.html)

BTW: I will be starting a problem solving series for math and programming soon where I will explain some problems in depth.

Update 1 (3 problems) 15 Jun 2022</content:encoded></item><item><title>On the Detection of COVID-19 through Radiology and Unsupervised Learning</title><link>https://weichen-huang.github.io/writing/covidunsupessay/</link><guid isPermaLink="true">https://weichen-huang.github.io/writing/covidunsupessay/</guid><description>We exploit Unsupervised Contrastive Learning techniques for the detection of COVID-19 through radiological images of the lung.</description><pubDate>Tue, 14 Jul 2020 00:00:00 GMT</pubDate><content:encoded>By Weichen Huang

COVID-19 (Coronavirus Disease 2019) is an infectious viral disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) that has claimed over 572,000 lives worldwide and injured many more. The first cases were seen in Wuhan, China, in late December 2019 before it spread globally and became a pandemic. The virus caused a devastating effect on daily lives, public health, and the global economy. It is critical to detect the positive cases as early as possible so as to prevent the further spread of this epidemic and to quickly treat affected patients. Definitive diagnosis of COVID-19 requires a positive RT-PCR test. Current best practice advises that chest radiological imaging such as computed tomography (CT) and X-ray have vital roles in early diagnosis and treatment of this disease. It is stated that CT is a sensitive method to detect COVID-19 pneumonia and can be considered as a screening tool with RT-PRC. In this article, we present a novel method that combines human lung x-ray images and deep learning models to reliably and quickly detect COVID-19 in real time.

Around two months ago, we proposed COVID-Efficientnet, which combines state of the art deep learning architectures with high quality labelled datasets to detect COVID-19 using X-ray images of lungs and is also able to detect diseases such as Pneumonia. However, a major flaw to this method is supervision. The COVID-19 X-ray datasets have to be labelled by humans and as to this day, this cannot be automated reliably. This is where my new method comes in: Unsupervised Contrastive Learning. we use a new method dubbed SimCLR by Google Research (A Simple Framework for Contrastive Learning of Visual Representations, https://arxiv.org/pdf/2002.05709.pdf). 

SimCLR proposed contrastive self-supervised learning algorithms without requiring specialized architectures or a memory bank. It showed that (1) composition of data augmentations plays a critical role in defining effective predictive tasks, (2) and introduced a learnable nonlinear transformation between the representation and the contrastive loss substantially improves the quality of the learned representations,and (3) contrastive learning benefits from larger batch sizes and more training steps compared to supervised learning. By combining these three innovations, SimCLR is able to considerably outperform previous methods for self-supervised and semi-supervised learning on ImageNet. A linear classifier trained on self-supervised representations learned by SimCLR achieves 76.5% top-1 accuracy, which is a7% relative improvement over previous state-of-the-art, matching the performance of a supervisedResNet-50.

We exploit this by contrasting the lung x-ray images of COVID-19 patients and of normal patients. Using this method, we achieved 92% accuracy on the test dataset, which is competitive compared to its supervised predecessors. Though this method isn&apos;t perfect and can lead to a few negative samples due to the methods used in unsupervised learning. This issue, however, has been addressed in recent papers such as Debiased Contrastive Learning (https://arxiv.org/abs/2007.00224) and our model can be greatly improved upon. Nonetheless, we present this particular work as a proof of concept and will be developing it over the coming weeks.

In summary, we present a novel method of using Unsupervised Contrastive Learning for radiological detection of COVID-19. This can achieve competitive results compared to supervised methods. However, it contains many issues such as negative samples.

The code to SimCLR is available here: https://github.com/google-research/simclr

Thanks for reading!</content:encoded></item><item><title>COVID-Efficientnet</title><link>https://weichen-huang.github.io/writing/covideffessay/</link><guid isPermaLink="true">https://weichen-huang.github.io/writing/covideffessay/</guid><description>I implemented Efficientnet for COVID-Detection though x-ray imaging.</description><pubDate>Fri, 01 May 2020 00:00:00 GMT</pubDate><content:encoded>COVID-Efficientnet: COVID-19 Detection with Chest X-ray Images and Deep Learning
by Weichen Huang

COVID-19 (Coronavirus Disease 2019) is an infectious disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2). The first cases were seen in Wuhan, China, in late December 2019 before spreading globally and becoming a pandemic. The virus has caused a devastating effect on both daily lives, public health, and the global economy. It is critical to detect the positive cases as early as possible so as to prevent the further spread of this epidemic and to quickly treat affected patients.
Definitive diagnosis of COVID-19 requires a positive RT-PCR test. Current best practice advises that chest radiological imaging such as computed tomography (CT) and X-ray have vital roles in early diagnosis and treatment of this disease. It is stated that CT is a sensitive method to detect COVID-19 pneumonia and can be considered as a screening tool with RT-PRC.
In this article, we present a novel method that combines human lung x-ray images and deep learning models to reliably and quickly detect COVID-19 in real time.

54-year-old patient with dyspnoea, cough and pyrexia (http://www.imj.ie/wp-content/uploads/2020/04/Imaging-of-Covid-19-an-Irish-Perspective-1.pdf)
Efficientnet
In ICML 2019, Google proposed EfficientNet, a novel model scaling method that uses “a simple yet highly effective compound coefficient to scale up CNNs in a more structured manner”. Unlike conventional approaches that arbitrarily scale network dimensions, such as width, depth and resolution, EfficientNet uniformly scales each dimension with a fixed set of scaling coefficients.

Efficientnet
The EfficientNets models surpass state-of-the-art accuracy with up to 10x better efficiency (smaller and faster).
Architecture
Inspired by COVID-Next and the efficiency and mobility of Efficientnet, we designed a COVID-19 x-ray image classification model (Covid-EfficientNet) based on EfficientNet using Pytorch. COVID-Efficientnet features an architecture that builds upon Efficientnet b7 architecture, an AutoML architecture for optimizing both accuracy and mobility.
Dataset
The dataset we compiled was based on two existing datasets:
-the COVID-19 x-ray dataset
-the RSNA (Pneumonia) dataset
We used the RSNA dataset to provide images of normal lungs at a large scale.
Performance
We achieved state of the art validation (05/05/20) performance for the accuracy metric for our dataset, outperforming COVID-Next and COVID-Net at 96% accuracy, a 2% increase from previous SOTA.
Code
Our code is available here:
https://github.com/weichen-huang/COVID-Efficientnet-Pytorch</content:encoded></item></channel></rss>