Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,103
» Latest member: Alpha
» Forum threads: 21,740
» Forum posts: 22,604

Full Statistics

Online Users
There are currently 507 online users.
» 1 Member(s) | 501 Guest(s)
Applebot, Baidu, Bing, Google, Yandex, Alpha

 
  [Oracle Blog] Developing Saga Participant Code For Compensating Transactions
Posted by: xSicKxBot - 04-13-2023, 07:57 PM - Forum: Java Language, JVM, and the JRE - No Replies

Developing Saga Participant Code For Compensating Transactions

Explanations and examples of the logic and code necessary to implement saga participants in compensating transactions.


https://blogs.oracle.com/java/post/devel...ansactions

Print this item

  [Tut] How I Created a Customer Churn Prediction App to Help Businesses
Posted by: xSicKxBot - 04-13-2023, 07:57 PM - Forum: Python - No Replies

How I Created a Customer Churn Prediction App to Help Businesses

5/5 – (1 vote)

Many businesses will agree that it takes a lot more time, money, and resources to get new customers than to keep existing ones. Hence, they are very much interested in knowing how many existing customers are leaving their business. This is known as churn.

Churn tells business owners how many customers are no longer using their products and services. It is also the rate at which an amount of money is lost as a result of customers or employers leaving the company. The churn rate gives companies an idea of business performance. If the churn rate is higher than the growth rate, it means that the business is not growing.

There are many reasons offered to explain customer churn. These include poor customer satisfaction, finance issues, customers not feeling appreciated, and customers’ need for a change. Understandably, companies have no absolute control over churn. But they can work to reduce to the barest minimum churn rate as regards the ones they have greater control.


As data scientists, your role is to assist these companies by building a churn model tailored to the company’s goals and expectations to predict customer churn. Due to the lack of data available to meet a company’s specific needs, it becomes challenging for data scientists to design an effective churn model.

However, we will make do with sample data for a fictional telecommunication company. You know, it is membership-based businesses performing subscription-based services that are mostly affected by customer churn. This data sourced by the IBM Developer Platform is available on my GitHub page.

The dataset has 7043 rows and 21 columns which comprise 17 categorical features, 3 numerical features, and the prediction feature. Check my GitHub page for more information about the dataset.

Data Preprocessing


This step will be taken to make the data suitable for machine learning. We will start by getting an overview of the dataset.

import pandas as pd
df = pd.read_csv('churn.csv') # get the shape of the dataset
df.shape
(7043, 21) # print the columns
df.columns
Index('customerID', 'gender', 'SeniorCitizen', 'Partner', 'Dependents', 'tenure', 'PhoneService', 'MultipleLines', 'InternetService', 'OnlineSecurity', 'OnlineBackup', 'DeviceProtection', 'TechSupport', 'StreamingTV', 'StreamingMovies', 'Contract', 'PaperlessBilling', 'PaymentMethod', 'MonthlyCharges', 'TotalCharges', 'Churn'], dtype='object') # check for missing values df.isna().sum() '''
customerID 0
gender 0
SeniorCitizen 0
Partner 0
Dependents 0
tenure 0
PhoneService 0
MultipleLines 0
InternetService 0
OnlineSecurity 0
OnlineBackup 0
DeviceProtection 0
TechSupport 0
StreamingTV 0
StreamingMovies 0
Contract 0
PaperlessBilling 0
PaymentMethod 0
MonthlyCharges 0
TotalCharges 0
Churn 0
dtype: int64 ''' #check for duplicates
df.customerID.nunique()
7043

Next, we drop the customerID column which was just there for identification purposes.

df.drop(['customerID'], axis=1, inplace=True)

The axis=1 means the columns. The inplace parameter is directly applied to the dataset.

If you take a look at the dataset using the head() method, you will notice that many features including the target feature have rows with values of Yes and No. We will transform them to 0 and 1 using LabelEncoder from the Scikit-learn library. We will also do the same with columns that have more than two categories.

from sklearn.preprocessing import LabelEncoder label_encoder = LabelEncoder()
obj = (df.dtypes == 'object')
for col in list(obj[obj].index): df[col] = label_encoder.fit_transform(df[col])

Model Building


It’s now time to train our data using Machine Learning algorithms. As we don’t know which model will perform well on our dataset, we will first test using different models.

from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.ensemble import GradientBoostingClassifier
from xgboost import XGBClassifier X = df.drop([‘Churn’], axis=1)
Y = df.Churn X_train, X_test Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=7) models = [LogisticRegression(), RandomForestClassifier(),AdaBoostClassifier(), SVC(), DecisionTreeClassifier(), KNeighborsClassifier(), GaussianNB(), ExtraTreesClassifier(), LinearDiscriminantAnalysis(), GradientBoostingClassifier(), ] scaler = StandardScaler()
rescaledX = scaler.fit_transform(x_train) for model in models: model.fit(rescaledX, Y_train.values) preds = model.predict(X_test.values) results = accuracy_score(Y_test, preds) print(f'{results}') '''
0.2753726046841732
0.7388218594748048
0.7388218594748048
0.7388218594748048
0.2753726046841732
0.26330731014904185
0.47906316536550747
0.27324343506032645
0.7388218594748048
0.30376153300212916
0.6593328601845281
0.7402413058907026 '''

The results show that XGBoost performed better than the other models in this dataset. Therefore, we will use XGBoost as our Machine Learning algorithm to predict customer churn.

Tuning XGBoost



The XGBoost algorithm achieved a 74% accuracy score. Can it do better? Let’s try tuning the model using learning curves. To understand what we meant by the learning curve, please read this article.

models = [LogisticRegression(), RandomForestClassifier(),AdaBoostClassifier(), SVC(), DecisionTreeClassifier(), KNeighborsClassifier(), GaussianNB(), ExtraTreesClassifier(), LinearDiscriminantAnalysis(), GradientBoostingClassifier(), ] scaler = StandardScaler()
rescaledX = scaler.fit_transform(x_train) for model in models: model.fit(rescaledX, Y_train.values) preds = model.predict(X_test.values) results = accuracy_score(Y_test, preds) print(f'{results}')

The results show that XGBoost performed better than the other models in this dataset. Therefore, we will use XGBoost as our Machine Learning algorithm to predict customer churn.

Tuning XGBoost


The XGBoost algorithm achieved a 74% accuracy score. Can it do better? Let’s try tuning the model using learning curves. To understand what we meant by the learning curve, please read this article.

# define the model
model = XGBClassifier() # define the datasets to evaluate each iteration
evalset = [(X_train, Y_train), (X_test, Y_test)] # fit the model
model.fit(X_train, Y_train, eval_metric='logloss', eval_set=evalset) # evaluate performance
preds = model.predict(X_test)
score = accuracy_score(y_test, preds) print(f'Accuracy: {round(score*100, 1)}%')
# Accuracy: 77.9%

Wow, the model has improved with 77.9% accuracy score. Can it still do better? Let’s increase the number of iterations from 100 (default) to 200 and reduce the eta hyperparameter to 0.05 (default is 0.3) to slow down the learning rate.

model = XGBClassifier(n_estimators=200, eta=0.05) # fit the model
model.fit(X_train, Y_train, eval_metric='logloss', eval_set=evalset) preds = model.predict(x_test) score = accuracy_score(y_test,preds) print(f'Accuracy: {round(score*100, 1)}%')
# Accuracy: 78.6%

This is the extent we can go. Of course, we can go on tuning the model to achieve a higher score. An accuracy score of 78.6% is not bad.

Create a new folder and save the following to a file named model.py.

#Import libraries
import pandas as pd
from xgboost import XGBClassifier
import pickle
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder df = pd.read_csv('churn.csv') # Drop customerID
df.drop(['customerID'], axis=1, inplace=True) # Convert to int datatype label_encoder = LabelEncoder()
obj = (df.dtypes == ‘object’)
for col in list(obj[obj].index): df[col] = label_encoder.fit_transform(df[col]) X = df.drop(['Churn'], axis=1)
Y = df.Churn # splitting the dataset
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=7) model = XGBClassifier(n_estimators=200, eta=0.05) # define the datasets to evaluate each iteration
evalset = [(X_train, Y_train), (X_test, Y_test)] # fit the model
model.fit(X_train, Y_train, eval_metric='logloss', eval_set=evalset) # saving the trained model
pickle.dump(model, open('lg_model.pkl', 'wb'))

Notice we save the trained model as a pickle object to be used later. We want the model to be running on Streamlit local server. So, we will create a Streamlit application for this. Create other files called app.py and predict.py in your current folder. Check my GitHub page to see the full content of the files.


Please remember to manually run the model.py to generate the pickle file as I won’t be pushing it to GitHub. After running the model.py file, the accuracy was 80.4% showing the model learned the data very well.


Conclusion


In this tutorial, we created a customer churn prediction app to help businesses deal with some of the challenges facing them. We use the XGBoost model to train the data and generate the model. There are many things we didn’t do. Data visualization, feature engineering, and dealing with imbalance classification are some of them.

You may wish to try them out and see if they can improve the model’s performance. Unfortunately, I wasn’t able to deploy the app because I couldn’t push the heavy pickle file to GitHub. Try pushing yours and then, you deploy it on Streamlit Cloud. Alright, enjoy your day.



https://www.sickgaming.net/blog/2023/04/...usinesses/

Print this item

  (Free Game Key) Peaky Blinders: Mastermind - Free Steam Game
Posted by: xSicKxBot - 04-13-2023, 07:55 PM - Forum: Deals or Specials - No Replies

Peaky Blinders: Mastermind - Free Steam Game

This game was removed from the steam store and other official retailers, so this may be your last chance to get it from an official source. Fanatical is offering a free steam key if you link your steam account to your Fanatical store account, and subscribe to their newsletter.

https://www.fanatical.com/en/game/peaky-blinders-mastermind

"To celebrate our Easter Eggstravaganza Sale, grab your copy of Peaky Blinders: Mastermind! Simply subscribe to our email newsletter and link a valid Steam account to pick up your Steam key. Your Steam account must have been used to make a purchase before. Only one game key per Fanatical account can be claimed."

Unused keys will expire on "May 10, 2023 at 10:59 PM (UTC)"

https://steamdb.info/app/1013310/ <- information on the removed game

?GrabFreeGames.com ?Twitter ?Steam Curator ?Facebook[fb.me]?Discord[discord.gg]
❤️Support us: HumbleBundle Partner[www.humblebundle.com] Fanatical Affiliate[www.fanatical.com]


https://steamcommunity.com/groups/GrabFr...3566666237

Print this item

  PC - Wall World
Posted by: xSicKxBot - 04-13-2023, 07:55 PM - Forum: New Game Releases - No Replies

Wall World



Welcome to the Wall World, a mining rogue-lite with tower defense elements. Explore procedurally generated mines and discover fantastical biomes. Find resources and technologies for purchasing valuable upgrades. Fight off hordes of aggressive monsters using your mobile base. Roam the Wall freely day and night, in various weather conditions. Find traces of "the others" and boldly mine where no man has mined before.

Publisher: Alawar Premium

Release Date: Apr 05, 2023




https://www.metacritic.com/game/pc/wall-world

Print this item

  [Oracle Blog] The Arrival of Java 20
Posted by: xSicKxBot - 04-11-2023, 09:24 PM - Forum: Java Language, JVM, and the JRE - No Replies

The Arrival of Java 20

The arrival of Java 20


https://blogs.oracle.com/java/post/the-a...of-java-20

Print this item

  (Indie Deal) New giveaways with King of Fighters, KOEI TECMO GAMES
Posted by: xSicKxBot - 04-11-2023, 09:24 PM - Forum: Deals or Specials - No Replies

New giveaways with King of Fighters, KOEI TECMO GAMES

[www.indiegala.com]
? Lady Luck smiles upon the determined gamers.
[www.indiegala.com]

NINJA GAIDEN: Master Collection
[www.indiegala.com]
Enjoy your game from the NINJA GAIDEN series.
Look forward to heated battles with fearsome opponents!
https://www.youtube.com/watch?v=y8ByV0Z5oBk&embeds_euri=https%3A%2F%2Fwww.indiegala.com%2F&feature=emb_imp_woyt&ab_channel=KOEITECMOEUROPELTD

BLUE REFLECTION: Second Light
[www.indiegala.com]
Save 50% on BLUE REFLECTION: Second Light
[www.indiegala.com]

NINJA GAIDEN: Master Collection Deluxe Edition
[www.indiegala.com]
Icludes:Digital Full Game/Digital Artboook & SoundTrack
https://www.youtube.com/watch?v=y8ByV0Z5oBk&embeds_euri=https%3A%2F%2Fwww.indiegala.com%2F&feature=emb_imp_woyt&ab_channel=KOEITECMOEUROPELTD

BLUE REFLECTION: Second Light Digital Deluxe Edition
[www.indiegala.com]
Under a piercing blue sky, surrounded by crystal clear water, the sun scorched Ao Hoshizaki's skin.Gazing at the summer scenery, it seemed as if the girl was left behind in a world that she had wandered into.[www.indiegala.com]


https://steamcommunity.com/groups/indieg...6287924715

Print this item

  PC - Road 96: Mile 0
Posted by: xSicKxBot - 04-11-2023, 09:24 PM - Forum: New Game Releases - No Replies

Road 96: Mile 0



Road 96: Mile 0 is a Narrative-Adventure game with a musical component created by DigixArt, the French studio behind the successful Road 96, 11-11 Memories Retold and 5 Pegases Awards winner.

Published by Ravenscourt, players will alternate between the roles of Zoe and Kaito, two teenagers with different backgrounds and beliefs. They live and explore White Sands, a luxurious condominium where Petria´s elite reside and where Kaito´s parents work.

Their journey in Road 96: Mile 0 will challenge their friendship and everything they believe in. They say money doesn't buy happiness, nor friendship. These teens are dreamers and they are going to learn where they belong. Will they remain friends?

Publisher: Ravenscourt

Release Date: Apr 04, 2023




https://www.metacritic.com/game/pc/road-96-mile-0

Print this item

  [Tut] Python List of Dicts to Pandas DataFrame
Posted by: xSicKxBot - 04-11-2023, 04:15 AM - Forum: Python - No Replies

Python List of Dicts to Pandas DataFrame

5/5 – (1 vote)

In this article, I will discuss a popular and efficient way to work with structured data in Python using DataFrames.

? A DataFrame is a two-dimensional, size-mutable, and heterogeneous tabular data structure with labeled axes (rows and columns). It can be thought of as a table or a spreadsheet with rows and columns that can hold a variety of data types.

One common challenge is converting a Python list of dictionaries into a DataFrame.

To create a DataFrame from a Python list of dicts, you can use the pandas.DataFrame(list_of_dicts) constructor.

Here’s a minimal example:

import pandas as pd
list_of_dicts = [{'key1': 'value1', 'key2': 'value2'}, {'key1': 'value3', 'key2': 'value4'}]
df = pd.DataFrame(list_of_dicts)

With this simple code, you can transform your list of dictionaries directly into a pandas DataFrame, giving you a clean and structured dataset to work with.

A similar problem is discussed in this Finxter blog post:

? Recommended: How to Convert List of Lists to a Pandas Dataframe

YouTube Video

Converting Python List of Dicts to DataFrame


Let’s go through various methods and techniques, including using the DataFrame constructor, handling missing data, and assigning column names and indexes. ?

Using DataFrame Constructor


The simplest way to convert a list of dictionaries to a DataFrame is by using the pandas DataFrame constructor. You can do this in just one line of code:

import pandas as pd
data = [{'a': 1, 'b': 2}, {'a': 3, 'b': 4}]
df = pd.DataFrame(data)

Now, df is a DataFrame with the contents of the list of dictionaries. Easy peasy! ?

Handling Missing Data


When your list of dictionaries contains missing keys or values, pandas automatically fills in the gaps with NaN values. Let’s see an example:

data = [{'a': 1, 'b': 2}, {'a': 3, 'c': 4}]
df = pd.DataFrame(data)

The resulting DataFrame will have NaN values in the missing spots:

 a b c
0 1 2.0 NaN
1 3 NaN 4.0

No need to manually handle missing data! ?

Assigning Column Names and Indexes


You may want to assign custom column names or indexes when creating the DataFrame. To do this, use the columns and index parameters:

column_names = ['col_1', 'col_2', 'col_3']
index_names = ['row_1', 'row_2']
df = pd.DataFrame(data, columns=column_names, index=index_names)

This will create a DataFrame with the specified column names and index labels:

 col_1 col_2 col_3
row_1 1.0 2.0 NaN
row_2 3.0 NaN 4.0

Working with the Resulting DataFrame


Once you’ve converted your Python list of dictionaries into a pandas DataFrame, you can work with the data in a more structured and efficient way.

In this section, I will discuss three common operations you may want to perform with a DataFrame:

  • filtering and selecting data,
  • sorting and grouping data, and
  • applying functions and calculations.

Let’s dive into each of these sub-sections! ?

Filtering and Selecting Data


Working with data in a DataFrame allows you to easily filter and select specific data using various techniques. To select specific columns, you can use either DataFrame column names or the loc and iloc methods.

YouTube Video

? Recommended: Pandas loc() and iloc() – A Simple Guide with Video

For example, if you need to select columns A and B from your DataFrame, you can use the following approach:

selected_columns = df[['A', 'B']]

If you want to filter rows based on certain conditions, you can use boolean indexing:

filtered_data = df[(df['A'] > 5) & (df['B'] < 10)]

This will return all the rows where column A contains values greater than 5 and column B contains values less than 10. ?

Sorting and Grouping Data


Sorting your DataFrame can make it easier to analyze and visualize the data. You can sort the data using the sort_values method, specifying the column(s) to sort by and the sorting order:

sorted_data = df.sort_values(by=['A'], ascending=True)

Grouping data is also a powerful operation to perform statistical analysis or data aggregation. You can use the groupby method to group the data by a specific column:

grouped_data = df.groupby(['A']).sum()

In this case, I’m grouping the data by column A and aggregating the values using the sum function. These operations can help you better understand patterns and trends in your data. ?

Applying Functions and Calculations


DataFrames allow you to easily apply functions and calculations on your data. You can use the apply and applymap methods to apply functions to columns, rows, or individual cells.

For example, if you want to calculate the square of each value in column A, you can use the apply method:

df['A_squared'] = df['A'].apply(lambda x: x**2)

Alternatively, if you need to apply a function to all cells in the DataFrame, you can use the applymap method:

df_cleaned = df.applymap(lambda x: x.strip() if isinstance(x, str) else x)

In this example, I’m using applymap to strip all strings in the DataFrame, removing any unnecessary whitespace. Utilizing these methods will make your data processing and analysis tasks more efficient and easier to manage. ?


To keep improving your data science skills, make sure you know what you’re going yourself into: ?


? Recommended: Data Scientist – Income and Opportunity



https://www.sickgaming.net/blog/2023/04/...dataframe/

Print this item

  (Indie Deal) Resident Evil 4 Raffles, Warner Bros Sale & more
Posted by: xSicKxBot - 04-11-2023, 04:15 AM - Forum: Deals or Specials - No Replies

Resident Evil 4 Raffles, Warner Bros Sale & more

Resident Evil 4 Remake Raffles
[www.indiegala.com]
The Easter Bunny hid some evil eggs this Spring!

We partnered with Resident Evil to bring you multiple chances to win the iconic Resident Evil 4 Remake[www.indiegala.com] for Steam. Where to start looking?

Here are some hints: Giveaways[www.indiegala.com], Facebook[www.facebook.com], Twitter...and more?
[http//%7Bhttps]
Warner Bros. Games Easter Sale, up to 85% OFF
[www.indiegala.com]
https://www.youtube.com/watch?v=DOywynZiBaQ
[vorax.indiegala.com]


https://steamcommunity.com/groups/indieg...8146377938

Print this item

  PC - Curse of the Sea Rats
Posted by: xSicKxBot - 04-11-2023, 04:15 AM - Forum: New Game Releases - No Replies

Curse of the Sea Rats



Curse of the Sea Rats is a 'ratoidvania' platform adventure with lovingly crafted, hand-drawn animations.

Embark on the epic journey of four prisoners of the British empire, transformed into rats by the notorious pirate witch, Flora Burn. To regain their human bodies, they will have to fight dangerous bosses, uncover the secrets of the vast Irish coast, and ultimately capture the witch who cursed them.

A labyrinthine network of hundreds of pathways, rooms and discoveries lie ahead, in a substantial quest with over 12 hours of content.

Can you master each character's playstyle, find all the hidden secrets, and unlock each of the game's multiple endings?

Publisher: PQube

Release Date: Apr 06, 2023




https://www.metacritic.com/game/pc/curse...e-sea-rats

Print this item

 
Latest Threads
(Xbox One) Vantage - Mod ...
Last Post: Alpha
9 minutes ago
News - GameStop Is Not Hu...
Last Post: xSicKxBot
8 hours ago
Lemfi Rebrand + World Cup...
Last Post: Sazzy01
11 hours ago
World Cup 2026 Lemfi Foun...
Last Post: Sazzy01
11 hours ago
World Cup 2026 Nigeria Le...
Last Post: Sazzy01
11 hours ago
World Cup 2026 Canada Off...
Last Post: Sazzy01
11 hours ago
World Cup 2026 Lemfi UK C...
Last Post: Sazzy01
11 hours ago
Lemfi Wiki + World Cup 20...
Last Post: Sazzy01
Today, 07:39 AM
Lemfi Transfer Time + Wor...
Last Post: Sazzy01
Today, 07:38 AM
Lemfi USA World Cup 2026 ...
Last Post: Sazzy01
Today, 07:36 AM

Forum software by © MyBB Theme © iAndrew 2016