File size: 3,934 Bytes
1bb0e99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
license: apache-2.0
task_categories:
- question-answering
- text-generation
language:
- en
tags:
- mental-health
- counseling
- conversations
pretty_name: Mental Health Counseling Conversational Dataset
size_categories:
- 1K<n<10K
---

# Mental Health Counseling Conversations (Cleaned)

## Dataset Overview

This dataset is derived from the original **[Amod/mental_health_counseling_conversations](https://huggingface.co/datasets/Amod/mental_health_counseling_conversations)** dataset, which contains mental health counseling conversations. 

In this version, **duplicate Context-Response pairs** have been removed to improve data quality and usability.

## Dataset Details

- **Dataset Name**: [arafatanam/Mental-Health-Counseling](https://huggingface.co/datasets/arafatanam/Mental-Health-Counseling)
- **Source Dataset**: [Amod/mental_health_counseling_conversations](https://huggingface.co/datasets/Amod/mental_health_counseling_conversations)
- **Modifications**: Removed redundant columns and duplicate Context-Response pairs
- **Format**: JSON (newline-delimited)

## Processing Steps

The dataset was prepared using the following steps:

1. Loaded the original dataset using the `datasets` library.
2. Identified and removed duplicate columns.
3. Dropped duplicate Context-Response pairs.
4. Computed statistics on response counts per prompt.
5. Saved the cleaned dataset as a JSON file.

## Code Used for Cleaning

```python
# Install necessary libraries
!pip install datasets

# Import required modules
from datasets import load_dataset
import pandas as pd

# Load dataset from Hugging Face
dataset = load_dataset("Amod/mental_health_counseling_conversations")

# Convert the dataset to a Pandas DataFrame (train split)
df = pd.DataFrame(dataset['train'])

# Remove duplicate Context-Response pairs
df_cleaned = df.drop_duplicates(subset=['Context', 'Response'])

# Calculate response count per prompt
response_counts = df_cleaned.groupby('Context').size().reset_index(name='response_count')

# Compute statistical insights
min_responses = response_counts['response_count'].min()
avg_responses = response_counts['response_count'].mean()
max_responses = response_counts['response_count'].max()

print(f"Minimum responses per prompt: {min_responses}")
print(f"Average responses per prompt: {avg_responses:.2f}")
print(f"Maximum responses per prompt: {max_responses}")

# Identify prompts with the highest and lowest number of responses
max_prompt = response_counts[response_counts['response_count'] == max_responses]['Context'].tolist()
min_prompt = response_counts[response_counts['response_count'] == min_responses]['Context'].tolist()

print(f"Prompt(s) with the highest responses ({max_responses}): {max_prompt}")
print(f"Prompt(s) with the lowest responses ({min_responses}): {min_prompt}")

# Calculate dataset reduction percentage
reduction = ((df.shape[0] - df_cleaned.shape[0]) / df.shape[0]) * 100

print(f"Original dataset shape: {df.shape}")
print(f"Cleaned dataset shape: {df_cleaned.shape}")
print(f"Percentage reduction in data: {reduction:.2f}%")

# Save cleaned dataset
df_cleaned.to_json('mental-health-counseling.json', orient='records', lines=True)
```

## Usage

This dataset can be used for:

- **Mental Health Chatbots**: Developing AI-driven support systems.
- **Sentiment Analysis**: Analyzing emotional tones in counseling dialogues.
- **Natural Language Processing (NLP)**: Training models for mental health-related text understanding.

## License

This dataset is released under the **Apache 2.0 License**.  
Please ensure compliance with licensing terms, especially regarding modifications and redistribution.  
For more details, refer to the [original dataset's license](https://huggingface.co/datasets/Amod/mental_health_counseling_conversations).

## Acknowledgments

Special thanks to the creators of **Amod/mental_health_counseling_conversations** for providing the original dataset.

---