Điều hướng

    Cộng đồng hỗ trợ lập trình viên Python tại Việt Nam

    Cộng đồng Python Việt Nam

    • Đăng ký
    • Đăng nhập
    • Tìm kiếm
    • Chuyên mục
    • Gần đây
    • Tags
    • Nổi bật
    • Thành viên
    • Nhóm
    1. Trang chủ
    2. khanhnn
    K
    • Hồ sơ
    • Đang theo dõi
    • Số người theo dõi
    • Số Chủ đề
    • Số bài viết
    • Hay nhất
    • Nhóm

    khanhnn

    @khanhnn

    administrators

    0
    Điểm tín nhiệm
    8
    Số bài viết
    67
    Số lượt người ghé thăm
    0
    Số người theo dõi
    0
    Đang theo dõi
    Đã gia nhập Trực tuyến lần cuối vào

    khanhnn Theo dõi
    administrators

    Bài viết hay nhất của khanhnn

    Thành viên này chưa đăng bài viết nào cả.

    Latest posts made by khanhnn

    • Đăng ký nhận thực tập sinh Python

      Chào các chuyên gia tuyển dụng,
      BQT cộng đồng nhận được rất nhiều CV đăng ký thực tập Python nhưng số lượng doanh nghiệp chấp nhận đào tạo sinh viên thực tập đang chưa đủ. Vì vậy BQT rất mong các nhà tuyển dụng cung cấp thông tin các doanh nghiệp cần sinh viên thực tập, BQT sẽ chuyển CV đến các doanh nghiệp (mỗi doanh nghiệp tối đa 10 CV).
      Mời anh chị cung cấp các thông tin bằng cách comment bài viết này:
      Email nhận CV:
      Tên doanh nghiệp:
      Địa điểm: Hà Nội/ Hồ Chí Minh/...
      Chúc anh chị ngủ ngon.

      được đăng trong Tuyển dụng
      K
      khanhnn
    • Tuyển dụng lập trình viên - Python Việt Nam

      Do nhu cầu về nhân lực lập trình viên Python, một số doanh nghiệp có nhu cầu tuyển dụng lập trình viên/ thực tập lập trình viên, Python Việt Nam xin làm cầu nối doanh nghiệp với các bạn. Yêu cầu cụ chung như sau:

      A. Với vị trí thực tập:

      -Sinh viên công nghệ, yêu thích Python.

      -Định hướng nghề nghiệp: làm việc với ngôn ngữ Python.

      B. Với vị trị lập trình viên:

      Có kinh nghiệp với ngôn ngữ Python

      Có tư duy thuật toán

      Có nhu cầu chuyển việc hoặc tìm việc làm thêm.

      Bạn vui lòng hoàn thành biểu mẫu dưới đây.

      https://goo.gl/forms/5rBQ1wpSu1Co6ORH2

      Skype: khanhnnvn

      Mobile: 0823 133 789

      Lưu ý:

      CV ghi rõ các khả năng, kinh nghiệm cũng như yêu cầu của bạn.

      p/s: BQT sẽ email chi tiết cho các bạn về doanh nghiệp bạn sẽ được giới thiệu.

      được đăng trong Tuyển dụng
      K
      khanhnn
    • Giới thiệu Tensorflow

      Sự phát triển của trí tuệ nhân tạo dẫn đến việc tìm hiểu về machine learning và deep learning đã trở thành xu thế hiện nay. Việc sử dụng các thư viện có sẵn để tính toán đã giúp việc tiếp cận các bài toán trở nên đơn giản hơn. Tensorflow là một thư viện phần mềm mã nguồn mở hỗ trợ mạnh mẽ các phép toán học để tính toán trong machine learning và deep learning. Hôm nay mình sẽ hướng dẫn các bạn những thứ cơ bản về tensorflow và tạo ra một mô hình training cơ bản bằng tensorflow.

      Những khái niệm cơ bản trong tensorflow
      Theo mình hiểú thì Tensorflow là một thư viện mã nguồn mở cung cấp khả năng xử lí tính toán số học dựa trên biểu đồ mô tả sự thay đổi của dữ liệu, trong đó các node là các phép tính toán học còn các cạnh biểu thị luồng dữ liệu. Trong tesorflow có một vài khái niệm cơ bản sau.

      Tensor
      Tensor là cấu trúc dữ liệu trong tensorflow đại diện cho tất cả các loại dữ liệu. Nói cách khác, tất cả các kiểu dữ liệu khi đưa vào trong tensorflow thì đều được gọi là Tensor. Vậy nên có thể hiểu được Tensorflow là một thư viện mô tả, điều chỉnh dòng chảy của các Tensor. Tensor có 3 thuộc tính cơ bản là rank, shape và type.

      Rank
      Rank là số bậc của tensor. Ví dụ Tensor = [1] thì có rank = 1, Tensor = [[3,4],[5,6]] thì sẽ có rank = 2. Việc phân rank này khá quan trọng vì nó đồng thời cũng giúp phân loại dữ liệu của Tensor. Khi các rank đặc biệt cụ thể, Tensor có những tên gọi riêng như sau:

      Scalar: Khi Tensor có rank bằng 0
      Vector: Vector là một Tensor rank 1. .
      Matrix: Đây là một Tensor rank 2 hay mảng hai chiều theo khái niệm của Python
      N-Tensor: Khi rank của Tensor tăng lên lớn hơn 2, chúng được gọi chung là N-Tensor.
      Shape
      Shape là chiều của tensor. Vi dụ Tensor = [[[1,1,1],[178,62,74]]] sẽ có Shape = (1,2,3), Tensor = [[1,1,1],[178,62,74]] sẽ có Shape = (2,3).

      Type
      Type kiểu dữ liệu của các elements trong Tensor. Vì một Tensor chỉ có duy nhất một thuộc tính Type nên từ đó cũng suy ra là chỉ có duy nhất một kiểu Type duy nhất cho toàn bộ các elements có trong Tensor hiện tại.

      Tạo chương trình Tensorflow đơn giản
      Một chương trình Tensorflow được chia thành hai phần chính. Phần thứ nhất là xây dựng mô hình tính toán (được gọi là construction phase), phần thứ hai là chạy mô hình vừa mới xây dựng (được gọi là execution phase). Bây giờ mình sẽ hướng dẫn viết chương trình tính hàm f(x,y) trong hình 9.1.

      Import Tensorflow
      Vì Tensorflow không phải là thư viện có sẵn trong python vì vậy khi sử dụng cần phải import >>> import tensorflow as tf

      Xây dựng graph
      Đầu vào để tính hàm f gồm 3 node trong đó node x và node y là các biến số còn 2 là hằng số. Bây giờ ta sẽ tạo 3 node này.

      >>> x = tf.Variable(3, name="x")
      >>> y = tf.Variable(4, name="y")
      >>> f = x*x*y + y + 2
      

      hoặc có thể tạo như sau

      >>> x = tf.Variable(3, name="x")
      >>> y = tf.Variable(4, name="y")
      >>> z = tf.constant(2)
      >>> f = x*x*y + y + z
      

      f cũng có thể tạo bằng cách

      >>> f = tf.add(tf.add(tf.multiply(tf.multiply(x,x), y), y), 2)
      

      Chạy mô hình vừa xây dựng
      Trên đây là tạo các node để tính hàm f. Trên thực tế các câu lệnh trên không thực thi bất kì một phép tính nào mặc dù nó chứa các phép toán. Thậm chí các biến x, y cũng không được khởi tạo bởi 2 giá trị 3 và 4. Để chạy mô hình này ta cần phải mở một sesion và dùng nó để thiết lập giá trị cho 2 biến x, y và tính toán hàm f (biến z không cần thiết lập vì dùng tf.constant thì nó đã được gán giá trị là hằng số rồi).

      >>> sess = tf.Session()
      >>> sess.run(x.initializer)
      >>> sess.run(y.initializer)
      >>> result = sess.run(f)
      >>> print(result) #42
      >>> sess.close()
      

      Thay vì sess.run() cho tất cả các node, ta có thể dùng cách sau

      with tf.Session() as sess:
          x.initializer.run()
          y.initializer.run()
          result = f.eval()
          print(result)
      

      Hàm f ở đây chỉ có 2 biến là x và y nên ta có thể khởi tạo từng biến một nhưng trong mạng neural network có hàng nghìn, hàng triệu biến thì chẳng nhẽ ta phải ngồi code hàng nghìn dòng khởi tạo biến hay sao? Câu trả lời là không. Thay vì khởi tạo từng biến, ta dùng hàm global_variables_initializer() để khởi tạo tất cả các biến

      init = tf.global_variables_initializer()
      
      with tf.Session() as sess:
          init.run()
          result = f.eval()
      

      Chúc các bạn thành công!

      được đăng trong Python AI
      K
      khanhnn
    • Hỏi về ToString trong Python

      Hi mọi ng, mình mới học Python, cho mình hỏi có hàm nào tương tự như ToString() trong Java hay C# ko?

      Mình có đoạn code như này:

      import pandas as pd
      
      dataset = pd.read_csv('./Regression/Salary_Data.csv')
      
      print(dataset)
      

      rõ ràng là hàm print biết làm sao để hiển thị dataset đúng cách.

      Nhưng mình đã thử nhiều cách mà k biết làm sao để lấy được đoạn string mà hàm print in ra màn hình đc.
      Mình đoán phải có 1 hàm kiểu toString hay j đó nhưng ko có, ko biết có ai hiểu vụ này ko?

      được đăng trong Python cơ bản
      K
      khanhnn
    • Python cho hệ thống

      The OS module in Python provides a way of using operating system dependent
      functionality.

      The functions that the OS module provides allows you to interface with the
      underlying operating system that Python is running on. (Windows, Mac or
      Linux.

      You can find important information about your location or about the process.

      Before we start, make sure that you have imported the OS module "import os"

      OS Functions explained

      os.system()	# Executing a shell command
      
      os.stat()	# Get the status of a file
      
      os.environ()    # Get the users environment
      
      os.chdir()   	# Move focus to a different directory
      
      os.getcwd()    	# Returns the current working directory
      
      os.getgid()    	# Return the real group id of the current process
      
      os.getuid()    	# Return the current process’s user id
      
      os.getpid()     # Returns the real process ID of the current process
      
      os.getlogin()   # Return the name of the user logged
      
      os.access()   	# Check read permissions
      
      os.chmod()    	# Change the mode of path to the numeric mode
      
      os.chown()   	# Change the owner and group id
      
      os.umask(mask)  # Set the current numeric umask
      
      os.getsize()   	# Get the size of a file
      
      os.environ()    # Get the users environment
      
      os.uname()   	# Return information about the current operating system
      
      os.chroot(path) # Change the root directory of the current process to path
      
      os.listdir(path)# List of the entries in the directory given by path
      
      os.getloadavg() # Show queue averaged over the last 1, 5, and 15 minutes
      
      os.path.exists()# Check if a path exists
      
      os.walk()   	# Print out all directories, sub-directories and files
      
      os.mkdir(path)	# Create a directory named path with numeric mode mode
      
      os.remove(path)	# Remove (delete) the file path
      
      os.rmdir(path)  # Remove (delete) the directory path
      
      os.makedirs(path)# Recursive directory creation function
      
      os.removedirs(path) # Remove directories recursively
      
      os.rename(src, dst) # Rename the file or directory src to dst
      

      OS Functions Examples
      Let's get started to see how we can use these OS functions.
      Get current working directory with os.getcwd()

      print os.getcwd()
      

      Get the status of a file with os.stat()

      print "Getting the status of: ", os.stat('/usr/bin/python')
      

      Execute a shell command with os.system()

      os.system('ls -l')
      

      Return the current process id with os.getpid()

      print os.getpid()
      os.chmod(path, mode)
      

      Change the owner and group id of path to the numeric uid and gid with os.chown()
      os.chown(path, uid, gid)
      Processes in the system run queue averaged over the last 1, 5, and 15 minutes
      print os.getloadavg()
      Check if a path exists with os.path.exists()
      if os.path.exists("file.txt"):
      Create a new directory named 'new_directory' if it doesn't exist already"
      os.path.exists("new_directory") or os.mkdir("new_directory")
      Check if the path is a directory or a file with os.path.isdir() & os.path.isfile()
      path = "/tmp"
      if os.path.isdir(path): print "That's a directory
      if os.path.isfile(path): print "That's a file"Create a directory with os.makedir()print os.mkdir('new_directory', 0666)Recursive create directories with os.makedirs()os.makedirs('dir_a/dir_b/dir_c')```
      Remove a directory with os.rmdir()

      print os.rmdir('directory')
      

      Recursively remove empty directories with os.rmdirs()

      os.removedirs('dir_a/dir_b/dir_c')
      

      Rename a file with os.rename()

      print os.rename('/path/to/old/file', '/path/to/new/file')
      

      Rename a file with shutil.move()

      print shutil.move('/path/to/old/file', '/path/to/new/file')
      
      

      Rename a file with shutil.copy()

      print shutil.copy('/path/to/old/file', '/path/to/new/file')
      

      Get the users home directory
      print os.path.expanduser('~')
      Check read permissions with os.access()
      path = '/tmp/file.txt'
      print os.access(path, os.R_OK)
      Get the users environment with os.environmen()
      home = os.environ['HOME']
      print home
      Move focus to a different directory with os.chdir()
      print os.chdir('/tmp')
      Print out all directories, sub-directories and files with os.walk()
      for root, dirs, files in os.walk("/tmp"):
      print root
      print dirs
      print files
      Get the last time a directory was accessed with os.path.getatime()
      os.path.getatime('/tmp')
      Get the last time a directory was modified with os.path.getmtime()
      os.path.getmtime('/tmp')
      Get the user ID with os.getuid()
      if os.getuid() != 0: print "you are not root"
      Get the group ID with os.getgid()
      print os.getgid()
      Return the name of the user logged in with os.getlogin()
      print os.getlogin()
      Returns a list of all files in a directory with os.listdir()
      for filename in os.listdir("/tmp"):
      print "This is inside /tmp", filename
      Get the size of a file with os.path.getsize()
      path.getsize("/tmp/file.txt")
      Using Python in your daily work is a good way to automate system administration
      tasks, when you feel that your shell scripts are to limited.

      được đăng trong Python System
      K
      khanhnn
    • Hi các bạn

      Chào các bạn

      được đăng trong Ứng dụng Python
      K
      khanhnn
    • Thông báo diễn đàn

      Chào các bạn.
      Diễn đàn Python Việt Nam đã quay trở lại.
      Chúc các bạn một ngày vui vẻ, hạnh phúc.

      được đăng trong Thông báo diễn đàn
      K
      khanhnn
    • Welcome to your NodeBB!

      Welcome to your brand new NodeBB forum!

      This is what a topic and post looks like. As an administrator, you can edit the post's title and content.
      To customise your forum, go to the Administrator Control Panel. You can modify all aspects of your forum there, including installation of third-party plugins.

      Additional Resources

      • NodeBB Documentation
      • Community Support Forum
      • Project repository
      được đăng trong Python cơ bản
      K
      khanhnn