Skip to content

Commit 8c0e6b3

Browse files
committed
added files.
0 parents  commit 8c0e6b3

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed
153 KB
Binary file not shown.

README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Fine-Tune BERT to Classify Text Data in MATLAB®
2+
3+
4+
## Getting started
5+
6+
This example shows how to fine-tune a pretrained BERT model for performing text classification.
7+
8+
9+
## Overview
10+
11+
In this example, you modify a pretrained BERT model for text classification. First, add new layers for classification. Then, retrain the model to fine-tune it, using the original parameters as a starting point. It includes three steps:
12+
1. Preprocess text data and initialize BERT model
13+
2. Set up and train the network
14+
3. Test the model
15+
16+
This example shows the steps for fine-tuning BERT in detail. An alternative approach for document classification using BERT is to use [trainBERTDocumentClassifier](https://www.mathworks.com/help/textanalytics/ref/trainbertdocumentclassifier.html) function.
17+
18+
## Setup
19+
Clone the repository into a local directory. Open the example script "FineTuning_BERT_for_Classification.mlx".
20+
21+
The example requires data to run. To download the data: :
22+
- Go to https://www.mathworks.com/help/textanalytics/ug/create-simple-text-model-for-classification.html.
23+
- Click on the button "Copy Command" on the top right of the page and paste it in MATLAB Command Window. This will open the example in the directory where the CSV file is stored.
24+
- Copy the CSV file from the example, and paste it in the cloned repository.
25+
- If the file is saved in a different location, change the code to point to the file.
26+
27+
## Required Products
28+
- MATLAB (R2024a or later)
29+
- Text Analytics Toolbox™ (R2024a or later)
30+
- Deep Learning Toolbox™ (R2024a or later)
31+
32+
## Contact
33+
Sohini Sarkar, ssarkar@mathworks.com
34+
35+
## License
36+
The license is available in license.txt file in this GitHub repository.
37+
38+
## Community Support
39+
[MATLAB Central](https://www.mathworks.com/matlabcentral)
40+
41+
42+
Copyright 2024, The MathWorks, Inc.

SECURITY.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reporting Security Vulnerabilities
2+
3+
If you believe you have discovered a security vulnerability, please report it to
4+
[security@mathworks.com](mailto:security@mathworks.com). Please see
5+
[MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html)
6+
for additional information.

license.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright (c) 2023, The MathWorks, Inc.
2+
All rights reserved.
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
6+
3. In all cases, the software is, and all modifications and derivatives of the software shall be, licensed to you solely for use in conjunction with MathWorks products and service offerings.
7+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8+
9+
10+
11+

0 commit comments

Comments
 (0)