Copyright
Gulf Professional Publishing is an imprint of Elsevier
50 Hampshire Street, 5th Floor, Cambridge, MA 02139, United States
The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB, United Kingdom
Copyright 2021 Elsevier Inc. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission in writing from the publisher. Details on how to seek permission, further information about the Publishers permissions policies and our arrangements with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency, can be found at our website: www.elsevier.com/permissions.
This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may be noted herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes in research methods, professional practices, or medical treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability for any injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the material herein.
Library of Congress Cataloging-in-Publication Data
A catalog record for this book is available from the Library of Congress
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library
ISBN: 978-0-12-821929-4
For information on all Gulf Professional Publishing publications visit our website at https://www.elsevier.com/books-and-journals
Publisher: Joe Hayton
Senior Acquisitions Editor: Katie Hammon
Editorial Project Manager: Hillary Carr
Production Project Manager: Poulouse Joseph
Cover Designer: Christian Bilbow
Typeset by TNQ Technologies
Biography
Hoss Belyadi is the founder and CEO of Obsertelligence, LLC, focused on providing artificial intelligence (AI) in-house training and solutions. As an adjunct faculty member at multiple universities, including West Virginia University, Marietta College, and Saint Francis University, Mr. Belyadi taught data analytics, natural gas engineering, enhanced oil recovery, and hydraulic fracture stimulation design. With over 10 years of experience working in various conventional and unconventional reservoirs across the world, he works on diverse machine learning projects and holds short courses across various universities, organizations, and the department of energy (DOE). Mr. Belyadi is the primary author of Hydraulic Fracturing in Unconventional Reservoirs (first and second editions) and is the author of Machine Learning Guide for Oil and Gas Using Python . Hoss earned his BS and MS, both in petroleum and natural gas engineering from West Virginia University.
Dr. Alireza Haghighat is a senior technical advisor and instructor for Engineering Solutions at IHS Markit, focusing on reservoir/production engineering and data analytics. Prior to joining IHS, he was a senior reservoir engineer at Eclipse/Montage resources for nearly 5 years. As a reservoir engineer, he was involved in well performance evaluation with data analytics, rate transient analysis of unconventional assets (Utica and Marcellus), asset development, hydraulic fracture/reservoir simulation, DFIT analysis, and reserve evaluation. He was an adjunct faculty at Pennsylvania State University (PSU) for 5 years, teaching courses in Petroleum Engineering/Energy, Business and Finance departments. Dr. Haghighat has published several technical papers and book chapters on machine learning applications in smart wells, CO2 sequestration modeling, and production analysis of unconventional reservoirs. He has received his PhD in petroleum and natural gas engineering from West Virginia University and a master's degree in petroleum engineering from Delft University of Technology.
Acknowledgment
We would like to thank the whole Elsevier team including Katie Hammon, Hilary Carr, and Poulouse Joseph for their continued support in making the publication process a success. I, Hoss Belyadi, would like to thank two individuals who have truly helped with the grammar and technical review of this book. First, I would like to thank my beautiful wife, Samantha Walstra, for her continuous support and encouragement during the past 2 years of writing this book. I would also like to express my deepest appreciation to Dr. Neda Nasiriani for her technical review of the book.
I, Alireza Haghighat, want to acknowledge Dr. Shahab D. Mohaghegh, who was my PhD advisor. He, a pioneer of AI & ML applications in the oil and gas industry, has guided me in my journey to learn petroleum data analytics. I would like to thank my wife, Dr. Neda Nasiriani, who has been incredibly supportive throughout the process of writing this book. She encouraged me to write, made recommendations that resulted in improvements, and reviewed every chapter of the book from a computer science point of view. I also want to thank Samantha Walstra for reviewing the technical writing of this book.
Chapter 1: Introduction to machine learning and Python
Abstract
This chapter covers basic definitions of Artificial Intelligence, machine learning, and data mining. It then provides step-by-step instructions on how to set up Python Anaconda and Jupyter Notebook and all useful shortcuts. Afterward, an introduction to the following Python concepts is given; including data structures, e.g., lists, dictionary, tuples, sets, and control flows, e.g., if statements, for loops, nested loops, while loops, list comprehension, and functions. These concepts are explained using step-by-step examples. Next, pandas and numpy libraries are discussed in depth with multiple oil and gas examples. Various pandas' functions and concepts such as column selection, basic statistics, column renaming/manipulation, loc/iloc, column calculations, column dropping, conditional selection, grouping by, joining, merging, concatenating, pandas operations, and dealing with missing values are discussed with examples. Finally, various numpy library concepts such as creating numpy array, n by n matrix, identity function, random numbers (both real and integer), etc., are discussed with examples. Numpy indexing and selections are also discussed at the end of this chapter.